I want to force my URL to have a "www" in the begning even if the user doesnt enter..

Discussion in 'Site & Server Administration' started by visualkreations, Jul 25, 2010.

  1. #1
    I want to force my URL to have a "www" in the begning even if the user doesnt enter it in.

    for example:

    if a user enter

    http://mydomain.com to instantly redircet to http://www.mydomain.com


    is this possible?

    Thanks.
     
    visualkreations, Jul 25, 2010 IP
  2. wechito

    wechito Peon

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes.
    You should make a 301 redirect from the non-www URl to the www URL
     
    wechito, Jul 25, 2010 IP
  3. kleampa

    kleampa Member

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Create a .htaccess file in your root public folder (www, public_html) with this content:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www.your_domain.com$
    RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301]
     
    kleampa, Jul 25, 2010 IP
  4. visualkreations

    visualkreations Well-Known Member

    Messages:
    454
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Thanks bro! it works
     
    visualkreations, Jul 25, 2010 IP
  5. ultimaterinks2006

    ultimaterinks2006 Member

    Messages:
    115
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #5
    If you are using any host like godaddy etc then there is no need to create separate file.You can configure it from there console.Let me know if you know detailed step by step guide.
     
    ultimaterinks2006, Jul 27, 2010 IP