[support] url rewrite force www for multi-sites

Jamie Holly hovercrafter at earthlink.net
Thu Jul 22 10:55:45 UTC 2010


In your settings.php file there's a $cookie_domain variable. Change it to:

$cookie_domain=".example.com"; // Make sure you get the . at the beginning.

That will force the session cookies to work for all all of example.com, 
including subdomains, of which www. is.

Jamie Holly
http://www.intoxination.net
http://www.hollyit.net


On 7/22/2010 12:15 AM, Christina Callahan wrote:
> I'm hoping to find a solution that hasn't presented itself after tons of
> searching...
>
> I'm running four sites on one Drupal6 codebase.  The first site is the
> main portal site and the other three are subsites.  So - the base URL
> for each site are as follows:
>
> http://example.com
> http://example.com/site1
> http://example.com/site2
> http://example.com/site3
>
> and the folder structure under /sites is:
>
> example.com
> example.com.site1
> example.com.site2
> example.com.site3
>
> The sites are all reachable with this current setup, however, I'm
> experiencing some login issues that I believe are a result of the
> example.com and www.example.com being regarded as two different sites.
> I figured that all I needed a simple as modification to the .htaccess in
> the /drupal directory, however I'm not able to rewrite the URLs
> successfully for all my sites.
>
> By modifying .htaccess to show
>
>     RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
>     RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
>
> I successfully redirect all of the pages on example.com to
> www.example.com, however example.com/site1, /site3, /site3 all get
> rewritten to www.example.com.
>
> I've not found a situation documented about this, and I've tried a
> number of different alternatives that don't seem to work.
>
> Any insights would be greatly appreciated.
> Thanks!
> Tina
>
>    


More information about the support mailing list