.htaccess Rewrite question

Discussion in 'Programming' started by skionxb, Sep 6, 2006.

  1. #1
    Hi,

    I am trying to redirect my non www version of the site to the www version

    http://infatex.com to http://www.infatex.com

    I used this code, and it works well:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^infatex\.com
    RewriteRule (.*) http://www.infatex.com/$1 [R=permanent,L]

    but i saw some people are using 301 redirect, that looks like this:

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


    Should i use [R=permanent,L] or [R=301,L] ?

    and one more question:

    What should i use to redirect www.infatex.com/index.php to www.infatex.com ???
    Thanks
     
    skionxb, Sep 6, 2006 IP
  2. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #2
    Permanent is a symbolic name for 301 redirect, so this codes are equivalent.
     
    wmtips, Sep 7, 2006 IP
  3. skionxb

    skionxb Peon

    Messages:
    376
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's what i thought :) Thank you!
     
    skionxb, Sep 7, 2006 IP