Which .htaccess should I use? I am lost

Discussion in 'Site & Server Administration' started by thecross, Aug 30, 2006.

  1. #1
    Hi all, I have read some articles on doing redirect and plan to redirect my old site to a new domain. I came across 2 types of redirect codes:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.mynewdomain.com/$1 [R=301,L]

    and

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www\.)?myolddomain\.com [NC]
    RewriteRule (.*) http://www.mynewdomain.com/$1 [L,R=301]

    1. Which one should I use?

    2. And will all my previous inbound links be directed to my new domain?

    3. One more question: as for saving the .htaccess file, which file extension should I save as? By default it is saved as .txt , but it will not respond to the redirect untill I manually delete the .txt extension on the root folder.

    Thanks in advance, hope someone can help me, as I do not want to do a stupid mistake and lose all my previous inbpound links or worse still get banned by google.
     
    thecross, Aug 30, 2006 IP
  2. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #2
    file extension for .htaccess :

    .htaccess IS the file extension since there is NOTHING before the DOT
     
    hans, Aug 30, 2006 IP
  3. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #3
    1. Stick with the first example. The condition in the second example is not necessary.

    2. Incoming traffic from links will be directed to your new site, but the links themselves will not change. You need to keep you old domain redirecting to your new one until you have replaced all the old links with new ones.

    3. File must be called .htaccess with no additional extension.

    Cryo.
     
    Cryogenius, Aug 30, 2006 IP
  4. thecross

    thecross Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi all, thanks cryogenius for the answes, will do that right away :)
     
    thecross, Aug 30, 2006 IP