How to set up a permanent 301 redirect

Discussion in 'Site & Server Administration' started by webrookie, Sep 12, 2009.

  1. #1
    webrookie, Sep 12, 2009 IP
  2. superdav42

    superdav42 Active Member

    Messages:
    125
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    put this in your .htaccess
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^chemtopper\.com
    RewriteRule (.*) http://chemtopper.com/$1 [R=301, L]
    
    Code (markup):
    This will redirect all traffic going to www.chemtopper.com to chemtopper.com. If you want to it work the other way around use this:
    
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{http_host} ^chemtopper.com [NC]
    RewriteRule ^(.*)$ http://www.chemtopper.com/$1 [R=301,L]
    
    Code (markup):
     
    Last edited: Sep 12, 2009
    superdav42, Sep 12, 2009 IP
  3. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #3
    You can also set preferred domain from your Google Webmaster tools (only for Google bot).

    Kailash
     
    kailash, Sep 13, 2009 IP
  4. webrookie

    webrookie Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks superdav. Its great having buddies like you around.
     
    webrookie, Sep 13, 2009 IP