PHP drops sessions

PHP drops sessions

Posted by: crimsondryad
Posted on: 2006-08-15 22:23:00

I just figured this out. Maybe it's a no-brainer, but I was dynamically generating my SSL url (ie, define(SSL_URL, https://mysite.com"); ) and didn't put the www in the web address. PHP would promptly drop the session as soon as it hit the page.

Has anyone else had any experience with this? Is there a workaround? I'm asking because I have a secure cert for http://mysite.com but the rest of the site is using http://www.mysite.com. So as soon as I attempt to use the cert, down it goes.

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com

Re: PHP drops sessions

Posted by: silkrooster
Posted on: 2006-08-15 22:44:00

Try using htaccess rewrite rule for the www then php should ok, I assume.lol.
Silk

Re: PHP drops sessions

Posted by: netdcon
Posted on: 2006-08-16 08:01:00

Try this in your root-level .htaccess file (if ya aint already done).

  RewriteEngine On
RewriteCond %{HTTP_HOST} !mysite.com
RewriteRule ^.*$ http://mysite.com%{REQUEST_URI} [R]

Re: PHP drops sessions

Posted by: crimsondryad
Posted on: 2006-08-16 15:10:00

I just tried that, it didn't work. Oh wait. The part on this particular site it needs to rewrite is ssl. Do I need to put "https" in the rewrite rule instead?

That probably seems like a no-brainer, but Mod Rewrites aren't my forte. :)

Thanks for the help!

================================
Angela Gann
CrimsonDryad Web Design Services
Web Design, Custom Software Development
http://www.crimsondryad.com

Re: PHP drops sessions

Posted by: netdcon
Posted on: 2006-08-17 11:33:00

In reply to:

I just tried that, it didn't work. Oh wait. The part on this particular site it needs to rewrite is ssl. Do I need to put "https" in the rewrite rule instead?


Ack, yah. Sorry about that. You needs multiple conditions; try:

  RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} !mysite.com
RewriteRule ^.*$ https://mysite.com%{REQUEST_URI} [R]

Tags: url httpscustom software developmentmysiteweb design servicesservices web designdesign custom softwarecertsslphpgannangelasessionsweb addresshttp