I'm currently using this code to redirect all request to index.php
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule ^([^.]+)/?$ index.php?get=$1 [L]
While having this universal code, how can I specify an individual redirect?
Eg, Redirect 301 /foo http://example.com/foo-bar
Place this above your current set of rules. The L
flag will cause Apache to stop processing the rest of the .htaccess file. Also be sure to clear your browser cache.
RewriteRule ^foo$ /foo-bar [R=301,L]
A nice tool for testing .htaccess files can be found here http://htaccess.mwl.be/
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.