Permanent redirection with regex after moving blog

Igor Sysoev is at rambler-co.ru
Thu Aug 13 11:10:36 MSD 2009


On Wed, Aug 12, 2009 at 05:33:25PM -0400, miles wrote:

> 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!

You should use the first method.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list