Hey guys I tried 3 methods to force www into the url and no method worked

Discussion in 'Programming' started by elieobeid7, Feb 8, 2011.

  1. #1
    Hey guys I tried 3 methods to force www into the url and no method worked...give me a forth one that will work 100% ;)
     
    elieobeid7, Feb 8, 2011 IP
  2. TimK

    TimK Peon

    Messages:
    51
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www.your_domain.com$
    RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301]
    
    Code (markup):
    Put that in a .htaccess file.
     
    TimK, Feb 8, 2011 IP
  3. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Lets also check the basics, is your site on Apache (possibly sold as "linux") or IIS (possibly sold as "Windows"). What serverside scripting language are you using?
     
    AstarothSolutions, Feb 8, 2011 IP
  4. elieobeid7

    elieobeid7 Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    it's on apache (linux) i have never hosted my sites on windows, nor did you :p i tried that script before, didn't work, it's is the basic method, i'll try it again for you. I have 2 pages on the site right now since it is under construction, the home page and the 404 error, the home page is html which is not a server side language and the 404 page is php, the whole website will be written in php once it's done.... and as you know i have an .htaccess file
     
    elieobeid7, Feb 9, 2011 IP