tags:

views:

88

answers:

1

Hello All, i'm asking about htaccess url rewrite ( mod_rewrite )

actually i want to change below URL

http://localhost/project/cms/edit_item.php?id=MYc= ( actually this is base 64 encoded)

to

http://localhost/project/cms/edit_item.php/id/MYc=

i do it like this on .htaccess file

RewriteEngine on
RewriteRule ^([\-_0-9A-Za-z]+)$  edit_item.php?id=$1 [L]

and save this on project folder but URL didn't modified

please suggest me how to do it

A: 
RewriteCond %{QUERY_STRING} id=(.+)
RewriteRule (edit_item.php) $1/id/%1?
Ignacio Vazquez-Abrams
not working dear? does i need to restart xampp and logout from site then it"ll be effective
JustLearn
It should not. I omitted the `RewriteEngine on` line there. Do you have it in place in the file before those lines?
Ignacio Vazquez-Abrams
If you want the browser to show the rewritten URL then you need to add the `[R]` flag.
Ignacio Vazquez-Abrams
actaullyyour suggestion works, when i see print_r($_SERVER)it show `[REQUEST_URI] => /project/cms/edit_item.php?id=MTc4` `[SCRIPT_NAME] => /project/cms/edit_item.php` `[PATH_INFO] => /id/MTc4` `[PATH_TRANSLATED] => D:\xampp\htdocs\id\MTc4` '[PHP_SELF] => /project/cms/edit_item.php/id/MTc4` but URL on address bar show`http://localhost/project/cms/edit_item.php?id=MTc4`
JustLearn
when i use [R]It become`http://localhost/D:/xampp/htdocs/project/cms/edit_item.php/id/MTc4`
JustLearn
... What? That doesn't even make any sense. What version of httpd is this?
Ignacio Vazquez-Abrams
in don't know the version dear?it's XAMPP for Windows Version 1.7.1 !
JustLearn