1

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.

3 Answers 3

2

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.

0

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

rewrite /index.asp$ http://www.hifimaven.com permanent;

0

No need to enclose in location

rewrite ^/index.asp$ http://www.hifimaven.com/ permanent;

You must log in to answer this question.