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 have a sub-domain, In my main-site,, I would like to rewrite to, but keep the url intact.

Is that something I can do with nginx rewrite rules?

share|improve this question

Quoting from the documentation I don't think this is possible:

If the replacement string begins with http:// then the client will be redirected, and any further rewrite directives are terminated.

share|improve this answer

You will need to look into doing a proxy_pass instead of a rewrite.

For example:

server {
  location /something {
     # you may use rewrites here to re-format the path portion of the
     # URL before passing it on.
     # e.g.:  rewrite ^/(abc)  /def last;
     proxy_pass; # Proxy on the request, without redirecting.
share|improve this answer

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.