How to optimize these config / rewrite rules
rob
nginx-forum at nginx.us
Wed Apr 18 14:53:55 UTC 2012
Hi there,
I'm running nginx and xenforo but need to rewrite some old legacy URL's
(left over from vbulletin + vbseo)..
Here is just a very small selection of my config which I want to
optimise as fully as possible:-
[code]
#Forum 26 main
location = /category-name-73/forum-name-26/ {
rewrite ^ /forums/forum-name.26/ permanent;
}
#Forum 26
location /category-name-73/forum-name-26/ {
#forum paging
rewrite ^/category-name-73/forum-name-26/index([\d]+).html
/forums/forum-name.26/page-$1 permanent;
#thread paging (modified version of kier's redirect script)
rewrite [^/]+/([\d]+)-.+-([\d]+).html /showthread.php?t=$1&page=$2
last;
#thread
rewrite [^/]+/([\d]+)-.+.html /threads/redirectme.$1/ permanent;
}[/code]
If only I can optimise the above then I can transfer the same principle
to the rest of my (huge) config file.
I've been told that its possible to optimise the above so that a visit
to /category-name-73/forum-name-26/ or any path below it will run just
one regex instead of potentially 4 as per the above code...
So, optimising the above... does anyone have any clue how to do this?
Thank you for any help offered,
Rob
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,225483,225483#msg-225483
More information about the nginx
mailing list