Rewrite all directory URLs with certain exceptions

Cristian Rusu crirus at gmail.com
Wed Nov 28 13:03:41 UTC 2012


Yes, this worked, I was also trying to get an idea of that matching in my
attempt...

Why is $1 not matching right?

---------------------------------------------------------------
Cristian Rusu
Web Developement & Electronic Publishing

======
Crilance.com
Crilance.blogspot.com



On Wed, Nov 28, 2012 at 2:58 PM, Antonio P.P. Almeida <appa at perusio.net>wrote:

> > On Wed, Nov 28, 2012 at 2:25 PM, Edho Arief <edho at myconan.net> wrote:
> >
> >> On Wed, Nov 28, 2012 at 7:11 PM, Cristian Rusu <crirus at gmail.com>
> wrote:
> >> > Excellent, it worked
> >> >
> >> > I have another urgent matter on a server live we just switched to
> >> >
> >> > I need that links like this:
> >> > http://www.example.com/?v=JYH253CT
> >> >
> >> > to be rewritten as http://www.example.com/v.php?dl=JYH253CT
> >> >
> >> >
> >> > Please help, server is down :(
> >> >
> >>
> >> http://nginx.org/en/docs/http/ngx_http_core_module.html#variables
> >>
> >> Maybe something like this.
> >>
> >> location = / {
> >>   if ($arg_v) {
> >>     rewrite ^ /v.php?dl=$arg_v;
> >>   }
> >> }
> >>
> >
> > I tried this from a htaccess to nginx converter
> >
> > if ($query_string ~ "^v=(.*)$"){
> >     rewrite ^/index\.php$ /v.php?dl=$1 break;
> > }
>
> Try:
>
> if ($arg_v) {
>     rewrite ^ /v.php?dl=$arg_v break;
> }
>
> --appa
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20121128/7887ffdc/attachment.html>


More information about the nginx mailing list