Rewrite new url and block old url in nginx
- by Howard
I have a local folder /bar, and I want to be able access via http://www.example.com/foo.
So I have the config like
rewrite ^/foo/(.*)$ /bar/$1 last;
At the same time, I want to block public access to the real url /bar,
Then I add the config like
location ~* ^/bar{ return 404; }
But when I add this url into the config, the 1st config above not work, now both return 404
Anything I should fix in order to make the rewrite work?
Thanks.