Return to Snippet

Revision: 4690
at January 16, 2008 03:07 by torkil

Initial Code
# forward from domain aliases
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?domain3\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?and_so_on\.com [NC]
RewriteRule (.*)$1 [R=301,L]
# END forward from domain aliases

Initial URL

Initial Description
Forward users from your alias domains to your main domain automatically. Nice to have if your site has got one or more aliases. Notice that all the domain aliases have [NC,OR] at the end of the line, while the last alias just has [NC].

Insert the code in your .htaccess-file in your website's root folder.

Initial Title
Forward from domain aliases to main domain

Initial Tags
url, htaccess, apache

Initial Language