1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to redirect http://domain.com to http://www.domain.com permanently

Discussion in 'Site & Server Administration' started by seoindiaweb, Nov 16, 2006.

Thread Status:
Not open for further replies.
  1. #1
    Hello there,
    I somewhere learned here on DP that you can permanent redirect the http:/domain.com to http:/www.domain.com through .htaccess
    but i dont know the exact rule of that
    Would anyone please give me that rule to write the above mentioned situation

    Thanx
     
    seoindiaweb, Nov 16, 2006 IP
  2. deezorder

    deezorder Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try


    RewriteEngine on

    RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
    RewriteCond %{HTTP_HOST} !^$
    RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]
     
    deezorder, Nov 16, 2006 IP
  3. iatbm

    iatbm Prominent Member

    Messages:
    5,157
    Likes Received:
    353
    Best Answers:
    0
    Trophy Points:
    310
    #3
    Code (Text):
    1.  
    2. RewriteBase /
    3. RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
    4. RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]
    5.  
    in your .htaccess :D
     
    iatbm, Nov 16, 2006 IP
Thread Status:
Not open for further replies.