Redirect all hosts which are NOT a particular host
4 posts
• Page 1 of 1
Redirect all hosts which are NOT a particular host
Hi,
How can I redirect all requests to a particular hostname if they came in on anything other than the domain I've chosen?
eg
redirect
examplea.com
exampleb.co.uk
exambled.fr
and have them *all* redirect to example.com? (I do not know all of the domains).
I've tried this:
... but it doesn't seem to match.
Thanks,
Nick
How can I redirect all requests to a particular hostname if they came in on anything other than the domain I've chosen?
eg
redirect
examplea.com
exampleb.co.uk
exambled.fr
and have them *all* redirect to example.com? (I do not know all of the domains).
I've tried this:
- Code: Select all
# Redirect all domains to main domain
RewriteCond Host: (?!www.\example\.com))
RewriteRule (.*) http\://www\.example\.com$1 [I,RP,L]
... but it doesn't seem to match.
Thanks,
Nick
Re: Redirect all hosts which are NOT a particular host
Please try like this:
[ISAPI_Rewrite]
# Redirect all domains to main domain
RewriteCond Host: (?!www\.example\.com).*
RewriteRule (.*) http\://www.example.com$1 [RP]
[ISAPI_Rewrite]
# Redirect all domains to main domain
RewriteCond Host: (?!www\.example\.com).*
RewriteRule (.*) http\://www.example.com$1 [RP]
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 8 guests