prettyurl i cannot print the value

I am trying to work with pretty url’s. but I don’t know how to grab the value. I never tried to use pretty url in my projects. I hope you can help me. I am new with this pretty url.

.htaccess

RewriteEngine on

RewriteRule ^([0-9]+)/$ test.php?id=$1

# not a file
RewriteCond %{REQUEST_FILENAME} !-f
# not a directory
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .? /404.php [L]

in my test.php

here is the only code inside in my test.php

if(isset($_GET['id'])){
    $id = $_GET['id'];
    echo $id;
} 

but it’s not printing.

I point my browser like this

http://localhost/myprojectfolder/test/1

structure of my project

myporjectfolder
   - index.php
   - .htaccess
   - test.php

Thank you in advance.


Source: .htaccess

Leave a Reply