Mod rewrite is an excellent solution with many applications. However it has absolutely no effect on session variables declared at the site root ( / ) level.

When a session is started, PHP passes the browser a cookie containing a session ID (a 32 byte MD5 string) which is used to reference a session file or other session handler by PHP when further requests are made. These are not URL dependent (only normal stored cookies can have a path assigned). The browser returns the cookie value as part of the headers in all further page requests, and PHP acquires the session by reading this value and reloading the values for the session into the global $_SESSION array.

At no point is the web server per se involved in reading these cookies, and it is unaffected by paths unless the user has turned off session cookies in their browser. In this case, by default PHP will append the session variable value (as above a 32 byte string) to all URLs, form actions and some other tags. This is the only occasion where you might have to trap for this - just ensure your Rewrite regex is robust and does not rely on query string values aht the end of a URL and you'll always be okay.

Cheers - Neil.

At 00:56 18/11/2003 +0000, Harlan wrote:

From: "Harlan Lax" <[EMAIL PROTECTED]>
Date: Mon, 17 Nov 2003 10:19:17 -0500
Subject: Passing Data between pages

As I am fairly new to web development I was looking into way to pass data
between pages on a web site.  I decided that using session variables was the
most attractive but it seems like most sights use url parameters.

I am now trying to use the apache mod-rewrite to allow the site to be
indexed by search engines.  Am I correct in assuming that mod-rewrite only
works with url parameters and not session variables?

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to