I am trying to do a 301 redirect of everything from an old subdomain to a new.
I have a simple .htaccess
Redirect 301 / http://www.smartphonesoft.com/
However if I goto the old URL with a subdir, it tries to redirect to the new domain with a subdir and fails.
ie
http://forum.smartphonesoft.com/reminder/
goe开发者_如何转开发s to
http://www.smartphonesoft.com/reminder/
When I would like it to goto
http://www.smartphonesoft.com/
How can I have everything simply redirected to the new domain root?
With Redirect
you define the base path (path prefix) that is to be redirected; every path beyond that is redirected while just replacing the base path with the new base path.
If you want to stick with mod_alias, you can use RedirectMatch
and omit the match:
RedirectMatch 301 ^/ http://www.smartphonesoft.com/
Assuming your server has support for mod_rewrite
, you can do this:
RewriteRule . http://www.smartphonesoft.com/ [R=301,L]
Alternatively, sticking to mod_alias
, this should also work (but I haven't tried it):
RedirectMatch 301 .* http://www.smartphonesoft.com/
精彩评论