Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I had an old site that was built with ASP, the homepage url looked like this "". But now the new site is built on top of RubyOnRails using nginx. and the new url to the homepage "".

How can I tell nginx to redirect to the new homepage url if the user types the old url instead of showing a 404 page.

share|improve this question

3 Answers 3

enclosing rewrite rule into location will make processing faster:

location = /index.asp {
       rewrite ^ permanent;

adding rewrite rule globally to server {} will cause nginx to check all request uri to the pattern in the rule. Location, especially with strict comparisong, is much faster and correct from ideological point of view.

share|improve this answer

im not the best at nginx rewrites but im pretty sure something like this should do

rewrite /index.asp$ permanent;

share|improve this answer

No need to enclose in location

rewrite ^/index.asp$ permanent;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.