Saturday, May 26, 2018

rewrite - nginx point subdomain to subfolder

I want http://blog.domain.com/ to point to http://www.domain.com/blog



Just a notice, not to redirect to that location, but just point to it.
Also /blog is not a folder. It could be blog.php for example



So when I navigate to http://blog.domain.com, the website display's content from http://www.domain.com/blog



What I tried so far:



server{

listen 80;
server_name blog.domain.com;

rewrite ^/blog(.*) http://blog.domain.com/$1 permanent;
}


The result is nginx returning 404 not found error.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...