Click to See Complete Forum and Search --> : how to rewrite multiple domains in htaccess?


TyeM
03-07-2008, 09:54 PM
Hello,

I am trying to rewrite to urls to one url, in the case of the example that url is www.domainname.com.au .


RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domain-name\.com\.au [NC]
RewriteCond %{HTTP_HOST} !^www\.domainname\.com\.au [NC]
RewriteRule (.*) http://www.domainname.com.au/$1 [R=301,L]

I have also tried:

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domain-name\.com\.au [NC]
RewriteRule (.*) http://www.domainname.com.au/$1 [R=301,L]

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domainname\.com\.au [NC]
RewriteRule (.*) http://www.domainname.com.au/$1 [R=301,L]


The first example above does not work, someone going to domain-name.com.au end up at www.domainname.com.au, though someone going to www.domain-name.com.au does not go to www.domainname.com.au.

The second example causes redirect errors.

Can someone offer a suggestion to achieve a situation that all users go to www.domainname.com.au?