Unable to access the site without tying www in the address bar

Discussion in 'Search Engine Optimization' started by puntertips, Apr 22, 2010.

  1. #1
    Hi all,
    My website( I can't revel the site address, lets us say XYZ.COM, doesn't show up without typing "www" in the address bar?

    That is:
    if i type:

    xyz.com or http://xyz.com it doesn't show

    only when i type:

    http://www.xyz.com or www.xyz.com the website is displayed.

    Any suggestion or did anyone had similar problem?
    care to enlighten me in this regard?

    Thanks for your help in advance!
    puntertips
     
    puntertips, Apr 22, 2010 IP
  2. cakey2k7

    cakey2k7 Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It is running something like drupal, wordpress, joomla? If so you can change the settings quite easily. If not you need to stick something in your htaccess to get it to redirect correctly. If I recall correctly something like this would work in your htaccess:

    # force www IN URL
    RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
    RewriteRule ^(/.*)$ http://www.example.com/$1 [R=301,L]
    # END force www IN URL
     
    cakey2k7, Apr 22, 2010 IP
  3. bruce_robart

    bruce_robart Member

    Messages:
    547
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #3
    your hosting sever OS is all dose matter in this problem above code is only work in Linux base server... so be clear with server OS..
     
    bruce_robart, Apr 22, 2010 IP
  4. jake1093

    jake1093 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes u need to do a 301 redirect for example add this to the second line of your .htaccess file
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yoursite.com$
    RewriteRule ^/?$ "http\:\/\/www\.yoursite\.com" [R=301,L]

    replace yoursite with your own site name and that should do. If you don't have a .htaccess file in your root directory then you need to make one.

    Cheers
     
    jake1093, Apr 22, 2010 IP