I have a URL like this:
/gallery/page.php?id=object
And I want to redirect this page to another page.
Using mod_rewrite, how can I redirect this URL?
I Try this:
RewriteCond %{QUERY_STRING} ^id=object$ [NC]
RewriteRule ^gallery/page.php/?$ http://www.mysite.com/gallery/page.php?id=new [R=301,L,NE]
But this doesn't work fine.
Thanks in advance
put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)id=object(&|$) [NC]
RewriteRule ^(gallery/page\.php)$ /$1?id=new [R=301,L,NC]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.