How to make a permanent redirection from http:// to http://www.?

Discussion in 'Apache' started by Voimis, Sep 20, 2009.

  1. #1
    Hi!

    How to redirect every viewer of the site from http:// to http://www.?

    The redirect should be permanent and it should include every file and every directory!

    My current .htaccess looks like this:



    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName mydomain.com
    Code (markup):
    I haven't modified it. The website uses CPanel.

    Thanks!
     
    Voimis, Sep 20, 2009 IP
  2. Asako

    Asako Peon

    Messages:
    266
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Thanks for the tips. It's really work :3
     
    Asako, Sep 20, 2009 IP
  3. Voimis

    Voimis Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the answer, thewebhostingdir!

    But before adding anything to my .htaccess I would like to know what's the actual difference between these two codes?

    In the first one the redirection method is written with letters (R=permanent) but in the second one it's with numbers (R=301). Does it make a difference?

    And why is there no $ in the end of the third string in the first code while there is in the second one? (^mydomain\.com vs. ^mydomain\.com$ [NC])

    And what does the [NC] do?

    Just wondering :)

    Thanks!
     
    Voimis, Sep 21, 2009 IP