开发者

regex .htaccess

开发者 https://www.devze.com 2023-02-19 20:53 出处:网络
I want to redirect a do开发者_StackOverflow社区main newspaper.com and newspapereds.com to news.com.The rewrite I am using is

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消