Andrew Martin
September 09, 2013 08:54AM
Thanks for the suggestions. I was not able to get $arg_title to work. Here
is the relevant section of my nginx config:
server_name mysite.com;

try_files $uri $uri/ index.php;

location / {
rewrite ^/index\.php?title=(.*)$
http://mysite.com/$arg_title redirect;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;

fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}

I also tried the rewrite rule inside of the "location ~ \.php$" block, but
it didn't work there either. Visiting
mysite.com/index.php?title=my_test_page just loads that URL, it does not
redirect to mysite.com/my_test_page. Moreover, visiting
mysite.com/my_test_page results in a 404. What else should I try to make
this rewrite rule work?

Thanks,

Andrew


On Mon, Sep 9, 2013 at 3:57 AM, edogawaconan <me@myconan.net> wrote:

> On Mon, Sep 9, 2013 at 3:58 PM, mex <nginx-forum@nginx.us> wrote:
> >> rewrite ^/index\.php?title=(.*)$ http://www.mysite.com/$1 redirect;
> >
> > this doesnt work? what is $1 then in the redirected request?
> >
>
> of course this won't work. Query string isn't part of rewrite matching
> string.
>
> Use $arg_title instead.
>
> http://nginx.org/en/docs/http/ngx_http_core_module.html#variables
>
> --
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite URL to only show value of $_GET argument

Andrew Martin September 09, 2013 12:04AM

Re: Rewrite URL to only show value of $_GET argument

mex September 09, 2013 02:58AM

Re: Rewrite URL to only show value of $_GET argument

edogawaconan September 09, 2013 05:00AM

Re: Rewrite URL to only show value of $_GET argument

Andrew Martin September 09, 2013 08:54AM

Re[2]: Rewrite URL to only show value of $_GET argument

artem September 09, 2013 09:06AM

Re: Re[2]: Rewrite URL to only show value of $_GET argument

Andrew Martin September 09, 2013 09:26AM

Re: Re[2]: Rewrite URL to only show value of $_GET argument

Francis Daly September 10, 2013 12:48PM

Re: Re[2]: Rewrite URL to only show value of $_GET argument

Andrew Martin September 10, 2013 10:10PM

Re: Re[2]: Rewrite URL to only show value of $_GET argument

Francis Daly September 11, 2013 08:44AM

Re: Re[2]: Rewrite URL to only show value of $_GET argument

Andrew Martin September 11, 2013 09:34AM

Re: Re[2]: Rewrite URL to only show value of $_GET argument

Francis Daly September 11, 2013 10:32AM

Re: Re[2]: Rewrite URL to only show value of $_GET argument

Andrew Martin September 16, 2013 06:50AM

Re: Rewrite URL to only show value of $_GET argument

GreenGecko September 19, 2013 07:54PM

Re: Rewrite URL to only show value of $_GET argument

Andrew Martin September 20, 2013 12:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 124
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready