0

I have used following mod_rewrite rules:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %(REQUEST_FILENAME) !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

to get www.myweb.com/newyork from www.myweb.com/index.php?url=newyork.

Now I trying to get pretty url for this page

www.myweb.com/itemdetail?itemid=1000

to

www.myweb.com/itemdetail/1000

I have been trying several mod_rewrite rules, but I have not been able solve it. Following are few rules I tried but no success.

 #RewriteCond %{QUERY_STRING} ^itemid=([A-Za-z0-9]+)
 #RewriteRule ^itemdetail.php /itemdetail/%1? [R=301,L]
 #RewriteRule ^itemid/([A-Za-z0-9]+)/?$ itemdetail.php?itemid=$1 [L]

 #RewriteRule ^itemdetail/([0-9]+)/?$ itemdetail.php?itemid=$1 [NC,L]
 #RewriteRule ^itemdetail/([0-9]+)/$ itemdetail.php?itemid=$1 [NC,L] 

Any suggestion?

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by pritaeas
0

I think you should use only line 5. It looks correct, what problem do you have with it?

But if you add it after the one you mentioned first (the one that works), then possibly this new one never gets triggered.

Edited by pritaeas

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.