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 <m...@myconan.net> wrote:

> On Mon, Sep 9, 2013 at 3:58 PM, mex <nginx-fo...@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

Reply via email to