Basic question : pointing non www to www.

Discussion in 'Site & Server Administration' started by seoindia, Mar 6, 2009.

  1. #1
    How did i set that if someone access my website without www it should also point to www version...Also my website in not in php and supports ISS..
     
    seoindia, Mar 6, 2009 IP
  2. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #2
    If you are on an Apache web server you can use the following:
    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.your\.com [NC]
    RewriteRule (.*) http://www.your.com/$1 [R=301,L]
    
    Code (markup):
    If you are on IIS then you may be out of luck but your host can advise.
     
    tolra, Mar 6, 2009 IP
  3. dhana_space1

    dhana_space1 Peon

    Messages:
    213
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3

    Go to root directory and edit this with your site name instead of "your" and add them in the .htaccess which will be in your root directory If not create one and do it.
     
    dhana_space1, Mar 6, 2009 IP
  4. cveks

    cveks Member

    Messages:
    141
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #4
    I think you should use www.
     
    cveks, Mar 6, 2009 IP
  5. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #5
    If you have IIS web server you can use following ISAPI rewrite rule:
        RewriteCond Host: ^domain\.com
        RewriteRule (.*) http\://www\.domain\.com$1 [I,RP]
    Code (markup):
    Kailash
     
    kailash, Mar 6, 2009 IP
  6. shruchi nagar

    shruchi nagar Guest

    Messages:
    144
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You can use redirect code or can add .htaccess file to redirect your website to www even when you didn't type www
     
    shruchi nagar, Mar 7, 2009 IP
  7. NickR25

    NickR25 Peon

    Messages:
    394
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks for the .htaccess code.

    I don't know why, but it only works for the root domain. I.e. when I visit my site, example.com it will change to www.example.com... which is fine.
    However, when I visit example.com/directory, it will not redirect to www.example.com/directory.

    How do I accomplish this?
    Thanks.
     
    NickR25, Mar 7, 2009 IP