[development] The www-subdomain (WAS: Re: Patching settings.php)

Morbus Iff morbus at disobey.com
Fri Aug 4 18:26:35 UTC 2006


>> base_url is not quite an acceptable solution.  Consider a site with 
>> base_url http://www.example.com/?q=user.  I provide my username and 
>> password, login get a cookie, etc.  Then I get forwarded to 
>> example.com (no www) and I find I am not logged in.  My cookie only 
>> works for www.example.com.
> 
> Right, in which case, you'd use the provided rewrite rules within the 
> .htaccess (which you were referred to from the new docs for base_url) to 
> manually force all your visitors to whatever domain you'd like.

To be more verbose:

/**
  * Base URL (optional).
  *
  * If you are experiencing issues with different site domains,
  * uncomment the Base URL statement below (remove the leading hash sign)
  * and fill in the URL to your Drupal installation.
  *
  * You might also want to force users to use a given domain.
  * See the .htaccess file for more information.

And:

   # If your site can be accessed both with and without the prefix www.
   # can use one of the following settings to force user to use only one
   #
   # If you want the site to be accessed WITH the www. only, adapt and
   # uncomment the following:
   # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
   # RewriteRule .* http://www.example.com/ [L,R=301]
   #
   # If you want the site to be accessed only WITHOUT the www. prefix,
   # and uncomment the following:
   # RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
   # RewriteRule .* http://example.com/ [L,R=301]

(Some words removed to prevent line wrapping).

-- 
Morbus Iff ( for safety's sake, don't humiliate me )
Technical: http://www.oreillynet.com/pub/au/779
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus


More information about the development mailing list