Permanent redirection with regex after moving blog

miles nginx-forum at
Thu Aug 13 01:33:25 MSD 2009

location ^~ /weblog/ {
rewrite ^/weblog/(.*) /blog/$1 permanent;

I believe there's also a way to use regex captures in the location.
I've not used this method yet, but I believe it's something like this:

location ~ ^/weblog/(.*) {
rewrite ^ /blog/$1 permanent;

Both solutions appear to work perfectly!
Thanks so much, Nick!

Posted at Nginx Forum:,4895,4902#msg-4902

More information about the nginx mailing list