Rewrite url based on cookie

Jonathan Vanasco nginx at 2xlp.com
Wed Jan 24 11:51:28 MSK 2007


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

> No, the $1 inside the "rewrite" directive is possible rewrite's  
> capture.

ah.  i never knew that!  glad i asked.

> You may use
>
> if ($http_cookie ~ "cookieName=([^;]+)(?:;|$)") {
>     set  $name  $1;
>     rewrite ^/index.html$  index$name.html;
> }

i meant to ask that first - as i've used something similar in the  
past, but then it looked like i could consolidate it one line further.




// 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