Forum Moderators: phranque
I currently use this on all my sites:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
but obviously that will only redirect example.com
[edited by: jdMorgan at 5:05 pm (utc) on Jan. 9, 2008]
[edit reason] example.com [/edit]
Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Jim
I don't want to redirect them all to www.example.com, that is easy enough to do - what I want is that when each domain is accessed without it's www. the user is redirect to the www. version of that domain
e.g. example1.com is called, it is redirected to www.example1.com
example2.com is called, it is redirected to www.example2.com
example3.com is called, it is redirected to www.example3.com
The parking means that they all share the same .htaccess file which is why I'm looking to do it from there.
Thanks
Mike
RewriteCond %{HTTP_HOST} [ b ] [ / b ]!^www\.
-or-
RewriteCond %{HTTP_HOST} [ i ] [ / i ]!^www\.
to prevent the space from being removed. Similarly, the forum software modifies the solid pipe character to a broken pipe "¦" character, and requires anyone copying-and-pasting code from this forum to hand-edit all instances of that character back to a solid pipe.
Sometimes I forget to use the space-eater work-around, and sometimes I forget to mention editing the pipe characters... <sigh>
Jim