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 need to forward all visitors from "" to "".

I know this has something to do with altering the nginx config file but am not sure what to do or what code to use.

I am using nginx as the server.

Any help would be appreciated :)

share|improve this question
Just do opposite:… – quanta Aug 2 '11 at 14:15
up vote 1 down vote accepted

In my own NGINX setup, I made a separate vhost for

server {
  rewrite  ^(.*)$1 permanent;
share|improve this answer
Thanks Sgaduuw your solution have helped and it works :) – Jayesh Gopalan Aug 4 '11 at 7:41

Apparently I can't just have a link as an answer...

Anyway, check out this question: Nginx: Forward all Subdomains

The config there should work for you.

share|improve this answer

You can rewrite the URL in the config file like this:

server {
    rewrite ^(.*)$1 permanent;

server {
    #My other config options
share|improve this answer
Thanks TiZon for your solution and it works and it helped me once again Thanks :) – Jayesh Gopalan Aug 4 '11 at 7:42
@Jayesh Gopalan Could you mark the question as solved then? That wey it won't pop up on the main page as an unsolved question. – Bart De Vos Aug 4 '11 at 8:01

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.