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

Discussion in 'General' started by nadlerz, Jan 5, 2013.

  1. nadlerz

    nadlerz Member

    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: Jan 6, 2013
  2. NiteWave

    NiteWave Administrator

    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. nadlerz

    nadlerz Member

    But I want those 3 domains still function and can be use.
    I want them to force www. version.

    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. nadlerz

    nadlerz Member

    I'm using this before:

    Is the right?

    Or I should remove:
    Options +FollowSymLinks
    RewriteBase /
  5. NiteWave

    NiteWave Administrator

    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]
  6. nadlerz

    nadlerz Member

    It works now :)
    Your the man !

    So no need for this codes:

    Options +FollowSymLinks
    RewriteBase / ?
  7. NiteWave

    NiteWave Administrator

    as long as it's working now, no need those extra 2 lines.

Share This Page