Redirect /olddir to /newdir

TECK nginx-forum at
Tue Feb 1 09:44:13 MSK 2011

Hi all,

I need your suggestions to create a rewrite rule in nginx that will
redirect the user from an old dir to the new one: to

location /newdir/ {
	try_files		$uri $uri/ /newdir/index.php?$uri&$args;
location /olddir/ {
	rewrite ^$request_uri? permanent;

The above rule does not work, it will redirect the user to, instead of
If an user types the url, nginx
should automatically redirect him/her to Right now, it brings the user to

Thanks for your help.

Posted at Nginx Forum:,171236,171236#msg-171236

More information about the nginx mailing list