Bug - Rewrite Rules

Maxim Dounin mdounin at mdounin.ru
Sun Jul 18 01:36:25 MSD 2010


On Sat, Jul 17, 2010 at 05:11:13PM +1000, mat h wrote:

> rewrite ^/forums/rss(/(news)+)?(/(digest)+)?(/(short|long)+)?(/([a-z0-9_-]+))?/([a-z0-9_]+)\.xml(\.gz)?$
> /forums/gymrss.php?$9=$8&$2&$4&$6&gzip=$10 last;
> rewrite "^/forums/[a-z0-9_-]*-[a-z]{1,2}([0-9]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$"
> /forums/gymrss.php?$8=$1&$3&$5&$7&gzip=$9 last;
> Version: 0.7.65-2
> I can provide more help if needed, just let me know.

It's not clear what are you trying to report, but above regexps 
won't work as nginx only supports $1..$9 enumerated captures.  And 
most likely they'll cause segfault in 0.7.*.  Segfault should be 
fixed in 0.8.25+.

Use non-capturing groups (i.e. "(?:...)", see man pcresyntax for 
details) to avoid extra numbering (and save some trees) and/or use 
named captures as available in 0.8.*.

Or, even better, stop using this ugly rewrites and parse urls in 
php code.

Maxim Dounin

More information about the nginx mailing list