1

I have a sub-domain, something.site.com. In my main-site, site.com/something, I would like to rewrite to something.site.com, but keep the url site.com/something intact.

Is that something I can do with nginx rewrite rules?

2 Answers 2

0

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.

http://wiki.nginx.org/HttpRewriteModule#rewrite

0

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

For example:

server { server_name site.com 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 http://something.site.com; # Proxy on the request, without redirecting. } } 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.