Permanent redirection with regex after moving blog

Igor Sysoev is at rambler-co.ru
Thu Aug 13 14:20:16 MSD 2009


On Thu, Aug 13, 2009 at 12:43:14PM +0300, Marcus Clyne wrote:

> miles wrote:
> >location ^~ /weblog/ {
> >rewrite ^/weblog/(.*) /blog/$1 permanent;
> >}
> >
> >location ~ ^/weblog/(.*) {
> >rewrite ^ /blog/$1 permanent;
> >}
> >
> >You should use the first method.
> >
> >Thanks so much, Igor - will do!
> >
> >Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4895,4912#msg-4912
> >
> >  
> Would
> 
> location /weblog/ {
> rewrite ^/weblog/(.*) /blog/$1 permanent;
> }
> 
> not be a little more efficient?

"location ^~ /weblog/" is more efficient than "location /weblog/" because
"^~" disables testing any regex locations. If server has no regex locations,
then these two locations are equal.


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





More information about the nginx mailing list