forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: alanlai on August 01, 2009, 06:27:07 am

Title: how cookies simultaneously work for both url one with www. and one does not
Post by: alanlai on August 01, 2009, 06:27:07 am
how cookies simultaneously work for both url one with www. and one does not


cookies treat not the same with:
http://www.sample.com VS http://sample.com

how to make one single cookies work for both?
Title: Re: how cookies simultaneously work for both url one with www. and one does not
Post by: Nibbler on August 02, 2009, 02:22:41 pm
That's how cookies work. If you want them to work across subdomains then you need to create them with a domain of ".sample.com". Coppermine doesn't have a cookie domain setting however.
Title: Re: how cookies simultaneously work for both url one with www. and one does not
Post by: Joachim Müller on August 02, 2009, 07:35:37 pm
Use a custom .htaccess file that takes care of the leading www subdomain to go out of harm's way.

To always use the leading www subdomain, use something like
Code: [Select]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

To always redirect from the leading www subdomain to just the domain, use something like
Code: [Select]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^.*$ http://domain.com%{REQUEST_URI} [R=301,L]
If you need details on that technology, google for it, as this is not related to coppermine.