问题
Redirect 301 /features/blahblah.php http://www.mysite.com/articles/blahblah1.php
results in http://www.mysite.com/articles/blahblah1.php?q=features/blahblah.php which is a 404 error page not found.
So what am i doing wrong here
回答1:
http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect documents exactly what's happening.
You probably want to use RedirectMatch, something like:
RedirectMatch ^/features/blahblah.php http://www.mysite.com/articles/blahblah1.php
If you want it to be a "permanent" redirect with HTTP status 301 (which can be desirable for SEO purposes) rather than a temporary 302 redirect, then instead use:
RedirectMatch permanent ^/features/blahblah.php http://www.mysite.com/articles/blahblah1.php
来源:https://stackoverflow.com/questions/5623225/redirect-301-why-is-my-old-url-being-appended-to-my-new-url-causing-a-404-erro