rewrite help

jeff emminger jemminger at gmail.com
Thu May 29 23:47:46 MSD 2008


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?

Thanks,
Jeff


On Thu, May 29, 2008 at 3:24 PM, jeff emminger <jemminger at gmail.com> 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 <jemminger at gmail.com> 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;
>> }
>>
>> Thanks,
>> Jeff
>>
>





More information about the nginx mailing list