I am trying to redirect the url
www.mydomain.com/index.php?route=first/second to www.mydomain.com/second I have tried the following rules but none seem to work
RewriteEngine On
1) RewriteRule ^index.php?route=first/second$ /second [R=301,L]
2) RewriteRule ^index.php?route=first/second$ www.mydomain.com/second [R=301,L]
3) Redirect ^index.php?route=first/second /second/
4) Redirect ^index.php?route=first/second www.mydomain.com/second/
5) Redirect ^www.mydomain.com/index.php?route=first/second /second/
6) Redirect ^www.mydomain.com/index.php?route=first/second www.mydomain.com/second/
However the below rule works: RewriteRule ^second$ /index.php?route=first/second [R=301,L]
but point 1 and 2 above does not work
Is there any solution to this?
确保在任何规则之前都将RewriteEngine On
。
Make sure: index.php
exists, else for that we have to set some condition for file existence
as well like RewriteCond %{REQUEST_FILENAME} !-f
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} route=first/second
RewriteRule .* /second? [R,L]
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.