Nginx config rewriting subdomain name to 1st URI segment
- by tim peterson
I'm unable to do the following nginx.conf rewrite:
test.mysite.info
to:
mysite.info/test
here's what i've tried:
server {
server_name test.mysite.info;
rewrite ^ https://mysite.info/test/$request_uri;
}
I know my DNS (Route53 AWS) is correct b/c:
test.mysite.info redirects to mysite.info (just not mysite.info/test)
I have an Apache server handling mysite.com which using .htaccess I can rewrite test.mysite.com to mysite.com/test.
I haven't changed anything else from the default nginx.conf installation so I'm totally confused as to why such a simple thing isn't working. Here is my full nginx.conf file if that is helpful.