You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Clarke <m-...@netyear.net> on 2002/12/27 08:54:21 UTC

[users@httpd] mod_rewrite and cookie values

Hi,

I have a bit of a problem and I hope that you can help.

I want to extract the value from a cookie and use it as a path name in a url
rewrite.

So far I have tried the below code in the httpd.conf file:

RewriteEngine On
RewriteRule   oldpage\.html$  %{HTTP_COOKIE}/newpage.html [R]

The cookie value is a directory name. I think the problem with the way I'm
doing it above is that it's returning the full key/value string of the
cookie when I only want the value. I don't know how to resolve the variable
to just the cookie value.

Any suggestions?

Thanks for your time.

Mike Clarke

--------------------
Michael Clarke
Software Engineer
Netyear Group Corporation
http://www.netyear.net
--------------------


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite and cookie values

Posted by Jurgen <ap...@squarehosting.com>.
Hi,

the only things that comes into my mind is a RewriteMap, which in your case probably needs to be a perl script or another program.

Jurgen


On Fri, 27 Dec 2002 16:54:21 +0900
"Michael Clarke" <m-...@netyear.net> wrote:

> Hi,
> 
> I have a bit of a problem and I hope that you can help.
> 
> I want to extract the value from a cookie and use it as a path name in a url
> rewrite.
> 
> So far I have tried the below code in the httpd.conf file:
> 
> RewriteEngine On
> RewriteRule   oldpage\.html$  %{HTTP_COOKIE}/newpage.html [R]
> 
> The cookie value is a directory name. I think the problem with the way I'm
> doing it above is that it's returning the full key/value string of the
> cookie when I only want the value. I don't know how to resolve the variable
> to just the cookie value.
> 
> Any suggestions?
> 
> Thanks for your time.
> 
> Mike Clarke
> 
> --------------------
> Michael Clarke
> Software Engineer
> Netyear Group Corporation
> http://www.netyear.net
> --------------------
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite and cookie values

Posted by Chris Taylor <ch...@x-bb.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Maybe something like 

RewriteEngine On
RewriteRule   oldpage\.html$  /redirect.php?%{HTTP_COOKIE} [R]

... and then have the short PHP script generate a redirect based on
the value of the cookie (I assume the variable name always stays the
same?).

Possibly easier than a rewrite map, but I only say that because I
like PHP :)

HTH,

Chris Taylor - chris@x-bb.org - The guy with the PS2 WebServer -
http://www.x-bb.org/chris.asc

- ----- Original Message ----- 
From: "Michael Clarke" <m-...@netyear.net>
To: <us...@httpd.apache.org>
Sent: Friday, December 27, 2002 7:54 AM
Subject: [users@httpd] mod_rewrite and cookie values


> Hi,
> 
> I have a bit of a problem and I hope that you can help.
> 
> I want to extract the value from a cookie and use it as a path name
> in a url rewrite.
> 
> So far I have tried the below code in the httpd.conf file:
> 
> RewriteEngine On
> RewriteRule   oldpage\.html$  %{HTTP_COOKIE}/newpage.html [R]
> 
> The cookie value is a directory name. I think the problem with the
> way I'm doing it above is that it's returning the full key/value
> string of the cookie when I only want the value. I don't know how
> to resolve the variable to just the cookie value.
> 
> Any suggestions?
> 
> Thanks for your time.
> 
> Mike Clarke
> 
> --------------------
> Michael Clarke
> Software Engineer
> Netyear Group Corporation
> http://www.netyear.net
> --------------------
> 
> 
> --------------------------------------------------------------------
> - The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPgzwXCqf8lmE2RZkEQKrDwCdG+VBC5jFsMIbIsb+Ats+jsF5S5QAn0uX
yA5IL4iNBdpCgyx303FYtslf
=52cp
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org