简体   繁体   中英

Subdomain to a subfolder in the main domain server

I have a domain hosted in an Amazon EC2 instance and DNS configuration managed with Route 53. This domain is "example.com" with this apache VirtualHost config:

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/
ServerName example.com
</VirtualHost>

I want to create a subdomain "hi.example.com" that point to a subfolder in the same server as the document root.

What I have tried:

I created an A record as an alias with the name "hi.example.com" and a the value of the A record of the main domain "example.com" that points to my EC2 ellastic IP and a VirtualHost config like this:

<VirtualHost *:80>
DocumentRoot /var/www/html/hi/
ServerName hi.example.com
</VirtualHost>

But that cause my "hi.example.com" goes to "hi.example.com/hi" and no finding nothing.

I want "hi.example.com" stay as the url in the browser and goes to subfolder in that subfolder writting the URL like a normal domain like "hi.example.com/page1","hi.example.com/page2", etc...

Thanks!

您是否尝试过按照以下说明进行操作: http : //docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingNewSubdomain.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM