How to rewrite these
Benjamin Pineau
ben at zouh.org
Sat Feb 20 17:42:41 MSK 2010
Glen Lumanau a écrit :
> Thank's for your prompt reply..
>
> However i tried this
>
> rewrite "/news/([0-9] {2})([0-9] {2})([0-9] {2})/$"
> http://app.mydomain.com/redirect/application/$1$2$3;
>
> but it doesn't work. What I've missed?
The regexp pattern isn't correct. You shouldn't have spaces before
the "{2}" unless you really want to match two consecutive spaces.
Even without those spaces, this pattern would match urls like
"/news/123456/" (without "/title" and with a trailing slash), while
you said you need to match "/news/$id/title" instead. Also, if you
want to fade out the old url in the long run, you could use a
permanent redirect.
You probably want something like that:
rewrite ^/news/([0-9]{6})/title$
http://app.mydomain.com/redirect/application/$1 permanent;
More information about the nginx
mailing list