mod rewrite puts the value missing in $_session variable

Oh, the strange things mod_rewrite does!

mod rewrite puts the value missing in $_session variable

Postby fahdmirza » Thu Jul 19, 2007 6:27 am

Hello,

Due to mod-rewrite rule, my $_session variable is getting the value 'missing', though I dont set it to 'missing' anywhere in the code.

My modrewrite rule is as follows:

RewriteEngine on
RewriteRule ^([a-z]+)\.html$ /sub_showproduct.php?publish=true&vpk=$1 [L]

My session variable is $_Session['userpk'], when I use modrewrite rule and print the value of session variable it prints 'missing', when I remove the modrewrite rule, it shows the correct value of session variable.

Any ideas please.

many regards.
fahdmirza
 
Posts: 2
Joined: Wed Jul 18, 2007 10:56 pm

Postby richardk » Thu Jul 19, 2007 12:31 pm

Is the session ID being passed through the URL? Try adding the QSA flag.

Due to mod-rewrite rule, my $_session variable is getting the value 'missing', though I dont set it to 'missing' anywhere in the code.

I doubt mod_rewrite would set a value to missing (unless missing is the name of the fake page (/missing.html)). Have you searched through all the PHP files? It could be done in an error checking function or something.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby fahdmirza » Thu Jul 19, 2007 8:30 pm

My hosting server had a file missing.html, but I deleted it and the hosting confirms that it isent present. I have also checked it with QSA flag, but in vain.

I am not passing session Id with the URL.

Please help.

regard.
fahdmirza
 
Posts: 2
Joined: Wed Jul 18, 2007 10:56 pm

Postby richardk » Fri Jul 20, 2007 12:34 pm

Try a simple session script or post your code. Mod_rewrite is highly unlikely to be doing this alone (especially as the mod_rewrite doesn't have "userpk" in it and session variables are stored in a file).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 1 guest

cron