Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.