rewrite help
jeff emminger
jemminger at gmail.com
Fri May 30 00:26:21 MSD 2008
[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
On Thu, May 29, 2008 at 3:47 PM, jeff emminger <jemminger at gmail.com> wrote:
> 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