0

I want to redirect a domain 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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Can I write it as RewriteCond %{HTTP_HOST} (paper|news)?
@Jean: Yes, that would match host names containing either “paper” or “news”.
@Jean: (paper|news) does match either “paper” or “news”.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.