I have Redirect like so:
Redirect 301 /url-1 /url-2
However, /url-2
matches a rewrite like such:
RewriteRule ^([^.]+)$ index.php?view=$1 [QSA,L]
This is redirecting /url-1
to:
/url-2?view=url-1
How can I get this to redirect and then rewrite correctly?
Few suggestions:
Redirect
directive with mod_rewrite
rules You can use these rules:
RewriteEngine On
RewriteRule ^url-1/? /url-2 [L,NC,R=301]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule [^/]$ %{REQUEST_URI}/ [L,R=301,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+?)/?$ index.php?view=$1 [QSA,L]
Remember to clear your browser cache before testing this.
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.