4 messages in ru.sysoev.nginxRe: rewrite help
FromSent OnAttachments
jeff emmingerMay 29, 2008 12:10 pm 
jeff emmingerMay 29, 2008 12:23 pm 
jeff emmingerMay 29, 2008 12:47 pm 
jeff emmingerMay 29, 2008 1:25 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: rewrite helpActions...
From:jeff emminger (jemm@public.gmane.org)
Date:May 29, 2008 1:25:58 pm
List:ru.sysoev.nginx

[SOLVED]

For posterity, here's how I got it working:

I ended up adding this to my root location /

if ($request_filename !~* .*\.(jpg|jpeg|gif|css|png|js|ico)$) { rewrite ^/subscribe([^\/]*)$ /subscribe/index.php$1 permanent; }

Seems to do the trick. -Jeff

Made some progress, but now the query_string is being doubled.

location /subscribe { index index.php; rewrite ^/subscribe$ /subscribe/index.php?$query_string
permanent; }

The above just about does it, but I end up now going from /subscribe?foo=bar

to: /subscribe/index.php?foo=bar?foo=bar

If I don't put in the $query_string, then I get nothing at all.

Any help on what I'm doing wrong?

On Thu, May 29, 2008 at 3:24 PM, jeff emminger
<jemm@public.gmane.org> wrote:

Also if it matters, this is a php URL being handled by fastcgi.

On Thu, May 29, 2008 at 3:11 PM, jeff emminger
<jemm@public.gmane.org> wrote:

How can I rewrite all:

/subscribe?foo=bar

into

/subscribe/?foo=bar

(note the trailing slash)

I've tried variations on this with no luck:

location / { root /var/www/docs/site.com/secure; index index.html index.htm index.php; rewrite ^/subscribe\?(.*) /subscribe/?$1 permanent; }

location /subscribe { index index.php; rewrite ^/subscribe\?(.*) /?$1 permanent; }