Take the 2-minute tour ×
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 "www.hifimaven.com/index.asp". But now the new site is built on top of RubyOnRails using nginx. and the new url to the homepage "www.hifimaven.com".

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 ^ http://www.hifimaven.com 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$ http://www.hifimaven.com permanent;

share|improve this answer

No need to enclose in location

rewrite ^/index.asp$ http://www.hifimaven.com/ permanent;
share|improve this answer

Your Answer


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