regex .htaccess
I want to redirect a do开发者_StackOverflow社区main newspaper.com and newspapereds.com to news.com. The rewrite I am using is
RewriteRule [paper] http://www.news.com. The problem is it does not redirect.
Thanks Jean
RewriteRule
will only try to match the pattern agains the URL path but not the host part. You need to use RewriteCond
instead:
RewriteCond %{HTTP_HOST} paper
RewriteRule ^ http://www.news.com
Besides that, [paper]
is a character class and matches only one occurrence of the containing characters p
, a
, e
, and r
.
精彩评论