[solved] How to redirect all request to www. url?

#1
I have 3 domains pointing on the same forum.
I want all of the 3 domain's will use www version.

Thanks !
 
Last edited by a moderator:

NiteWave

Administrator
#2
use rewriterule to do it

RewriteCond %{HTTP_HOST} domain1.com [OR]
RewriteCond %{HTTP_HOST} domain2.com [OR]
RewriteCond %{HTTP_HOST} domain3.com
RewriteRule (.*) http:///www.domain.com/$1 [R=301,L]
 
#3
use rewriterule to do it

RewriteCond %{HTTP_HOST} domain1.com [OR]
RewriteCond %{HTTP_HOST} domain2.com [OR]
RewriteCond %{HTTP_HOST} domain3.com
RewriteRule (.*) http:///www.domain.com/$1 [R=301,L]
But I want those 3 domains still function and can be use.
I want them to force www. version.

Like.
domain.net will redirect to www.domain.net
domain.me will redirect to www.domain.me
domain.info will redirect to www.domain.info

Not to redirect theme all to a single www url.
 
#4
I'm using this before:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.domain\.net$
RewriteRule ^(.*)$ http://www.domain.net/$1 [R=301,L]
Is the right?

Or I should remove:
Options +FollowSymLinks
RewriteBase /
 

NiteWave

Administrator
#5
base on your description, it looks what you want is:

RewriteEngine on

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

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

RewriteCond %{HTTP_HOST} ^domain\.info$ [NC]
RewriteRule ^(.*)$ http://www.domain.info/$1 [R=301,L]
 
Top