views:

12

answers:

1

hi i just applied a new url structure to my site the links were like this before using rewrite mod /detail.php?id=123 and after /restaurant123.htm

but the problem is /detail.php?id=123 still work and i've spent a week to do something to redirect /detail.php?id=123 to /restaurant123.htm without an infinite loop and i searched all over the internet but couldn't fix it any idea? thanks

A: 

I think you forget the [L] flag in the RewriteRule of your .htaccess

Can we see your .htaccess ?

Spilarix
RewriteRule ^(.*)restaurant([0-9]+)\.htm detail.php?id=$2 [L,QSA]
PHP lover
and for the redirect i tried this code but it doesn't work RewriteCond %{THE_REQUEST} ^[A-Z]+\ /detail\.php\ HTTP/RewriteRule ^detail\.php\?id=([0-9]+)$ http://www.118food.com/restaurant$1.htm [R=301,L]
PHP lover
You can try this to rewrite : RewriteRule restaurant([0-9]+)\.htm detail.php?id=$1 [L,QSA]
Spilarix