Welcome! Log In Create A New Profile

Advanced

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

Andrew Martin
September 20, 2013 12:36AM
Steve,

Thanks for the suggestion. How would this additional check change the
solution I proposed on 9/16? It looks like it would prevent the rewrite
from occurring if other arguments (instead of title) were present?

Thanks again,

Andrew


On Sun, Sep 8, 2013 at 11:31 PM, Steve Holdoway <steve@greengecko.co.nz>wrote:

> I think you need to do some regexp on the args
>
> if ( $args ~ title=([^&]+) {
> rewrite ^(.*)title=([^&]+).*$ /article/$2? last;
> }
>
> Note... totally untested.
>
> Steve
>
>
> On Sun, 2013-09-08 at 23:01 -0500, Andrew Martin wrote:
> > Hello,
> >
> >
> > I have read through the nginx rewrite documentation and looked at
> > various examples, but can't figure out how to create a rewrite rule
> > for the following (if it is possible). I'd like to rewrite the URL of
> > a php file with a $_GET argument and replace it with just the value of
> > the $_GET argument. For example, I'd like to
> > replace /index.php?title=my_example_title with /my_example_title
> > or /article/my_example_title. I've tried several regular expressions
> > to match index.php, as well as the $args and $arg_title nginx
> > variables, but cannot get this working. For example:
> > rewrite ^/index\.php?title=(.*)$ http://www.mysite.com/$1 redirect;
> >
> >
> >
> > Can anyone provide inside into how to correctly rewrite this type of
> > URL?
> >
> >
> > Thanks,
> >
> >
> > Andrew
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
>
> --
> Steve Holdoway BSc(Hons) MIITP
> http://www.greengecko.co.nz
> Linkedin: http://www.linkedin.com/in/steveholdoway
> Skype: sholdowa
>
> _______________________________________________
> 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: 93
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