Rewrite url based on cookie

Jonathan Vanasco nginx at 2xlp.com
Wed Jan 24 11:08:52 MSK 2007


On Jan 24, 2007, at 1:21 AM, Igor Sysoev wrote:

> On Wed, 24 Jan 2007, Jason B wrote:
>> RewriteRule ^index.html$ index%{HTTP_COOKIE['cookieName']}.html
>
>       location = /index.html  {
>           set  $name  "";
>           if ($http_cookie ~ "cookieName=([^;]+)(?:;|$)") {
>               set  $name  $1;
>           }
>           index  index$name.html;
>       }


would this also work?

if ($http_cookie ~ "cookieName=([^;]+)(?:;|$)") {
	rewrite index$1 ;
}



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -







More information about the nginx mailing list