How to change drupal from http://domain.com to http://www.domain.com

Discussion in 'Drupal' started by StudentLife, Oct 27, 2009.

  1. #1
    So I have setup a 301 redirect to do this, however the actual drupal installation still thinks that it is installed at http://domain.com rather than http://www.domain.com. This is a problem because I have installed the sitemaps module, and Google Webmaster Tools is giving me tons of errors because my site is at the www, but my sitemap is pointing to the non-www version. How can I fix this?

    Thanks in advance!
     
    StudentLife, Oct 27, 2009 IP
  2. aap

    aap Well-Known Member

    Messages:
    1,802
    Likes Received:
    39
    Best Answers:
    2
    Trophy Points:
    120
    #2
    you have to edit .htacess file which is present in drupal installation directory.


    Just un-comment these lines, and replace example.com to yoursite.com
    
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
    
    Code (markup):
     
    aap, Oct 27, 2009 IP