All the advice online says do: rewrite 301 URL-A URL-B
But that wo开发者_高级运维n't work if I turn on mod_rewrite (it seems?) with RewriteEngine on
So, I'm bad a regex, but shouldn't need it here. How do I do:
RewriteCond %{HTTP_HOST} ^untamed-adventures.com/travel/How/tabid/58/Default.aspx [NC]
RewriteRule ^(.*)$ http://untamed-adventures.com/ [R=301,L]
%{HTTP_HOST}
expands to the host of the request, so it could never match untamed-adventures.com/travel/How/tabid/58/Default.aspx
, only untamed-adventures.com
.
If you want to forward http://untamed-adventures.com/travel/How/tabid/58/Default.aspx
to http://untamed-adventures.com/
, try this:
RewriteCond %{HTTP_HOST} =untamed-adventures.com
RewriteRule ^/travel/How/tabid/58/Default.aspx$ http://untamed-adventures.com/ [R=301]
The L
flag is redundant; a forward is always final.
Not at all clear what you're trying to do. HTTP_HOST is the hostname part in the requested URL, in this case, "untamed-adventures.com", so that RewriteCond will never match.
I think that what you're trying to do is:
Redirect 301 /travel/How/tabid/58/Default.aspx http://untamed-adventures.com/
In which case, mod_rewrite isn't needed at all.
精彩评论