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.

Because of my carelessness, I put http://www.domain.com:8080/xxx/index.html on the internet. I don't want to lose that traffic, so i want to permanent redirect that url to http://www.domain.com/xxx/index.html Can nginx achieve this? thanks

share|improve this question
thanks,how can i close the question,i new here –  mlzboy Jan 25 '11 at 1:59
Click the check mark under the answer that was the best. –  Martin Fjordvald Jan 25 '11 at 1:59

1 Answer 1

server {
    listen www.domain.com:8080;
    server_name  www.domain.com;
    rewrite ^ http://www.domain.com permanent;    

Should do it.

share|improve this answer
Unless you really need the extra folder path - /xxx/index.html –  Jon Rhoades Sep 14 '10 at 2:34
in which case rewrite ^ domain.com$request_uri permanent; would do it. –  Martin Fjordvald Sep 14 '10 at 12:40

Your Answer


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