Forum Moderators: phranque
Let's say that you got 30 domain names pointing to 1 IP address and that you want to redirect all the non-www versions of your domains to their www versions. Now let's suppose that you are very lazy, and that you don't want to add the *classical* redirect code for each domain but try to automatize it and say that by default, no matter the domain name, automatically redirect it to his www version... Is it just a dream or there is hope ?
Here is what I'd like to avoid :
RewriteCond %{HTTP_HOST} !^www.domain1.com$ [NC]
RewriteRule ^(.*)$ http://www.domain1.com/$1 [r=301,L]
RewriteCond %{HTTP_HOST} !^www.domain2.com$ [NC]
RewriteRule ^(.*)$ http://www.domain2.com/$1 [r=301,L]
...
RewriteCond %{HTTP_HOST} !^www.domain30.com$ [NC]
RewriteRule ^(.*)$ http://www.domain30.com/$1 [r=301,L]
Let me know your thoughts !
Thanks in advance
The above is "made by Jim".
[webmasterworld.com...]
Replace the broken pipe "¦" characters in all code above with solid pipes before use.