httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Little <>
Subject [users@httpd] Cookie-Based Rewrite
Date Thu, 09 Mar 2006 13:31:50 GMT
Sorry if this has been asked before; I tried to find if there were
searchable archives for this list, but couldn't find anything.

I want to do a rewrite based on the value of a cookie. I have a rule in
doc root for the domain, which directs it to the demo directory based on 
the third-level domain:

  RewriteCond %{HTTP_HOST} ^$
  RewriteCond %{REQUEST_URI} !^/demo/
  RewriteRule (.*) /demo/$1

This works fine. From there, I want to re-direct to a sub-directory with 
the same name as the value of the cookie phn_demo, if the cookie is
set. I tried this:

  RewriteCond %{HTTP_COOKIE} phn_demo=(.*)
  RewriteRule (.*) /demo/%1/$1

but get a 500 error, which strangely doesn't show up in the logs. If the 
cookie is not set, I don't get an error.

Alan Little
Holotech Enterprises

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message