www on website address

Discussion in 'Site & Server Administration' started by webhost2, Jun 13, 2010.

  1. #1
    When i type my website address ex:name.com it shows in the browser http://name.com
    But i want it to show as http://www.name.com even if i didn't include WWW while typing.
    ex: when u type google.com the address on the bar will be automatically http://www.google.com

    How can i do this?
     
    webhost2, Jun 13, 2010 IP
  2. oxyhosts2010

    oxyhosts2010 Peon

    Messages:
    11
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi,
    If you are using a Linux server with Apache as webserver, try the following.

    Create a file ".htaccess" in your home folder and add the following code in it.
    =================
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^yourdomain.com
    RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
    =================

    Then save the file and set the user's ownership to ".htaccess" using the chown command. This will do the trick :)
     
    oxyhosts2010, Jun 13, 2010 IP
    webhost2 likes this.
  3. webhost2

    webhost2 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It worked. thank u very much buddy
     
    webhost2, Jun 13, 2010 IP