简体   繁体   中英

How to setup virtual hosts in xampp with same parent server alias or name

I want to set up 2 virtual hosts on my local xampp environment, I have two different WordPress websites with URLs

test.com and test.com/blog

Now I want to set up vhosts for local like test.local and test.local/blog

test.local works but test.local/blog redirects to test.local's 404 page

xampp vhosts configuration:

<VirtualHost *:80>
    DocumentRoot "/xampp/htdocs/test.com"
    ServerName test.local
</VirtualHost>

<VirtualHost *:80>
    ServerName test.local/blog
    DocumentRoot "/xampp/htdocs/blog-test.com"
 </VirtualHost>

hosts file setup:

127.0.0.1       test.local
127.0.0.1       test.local/blog

ServerName can be used for 2 or more different domains when configuring virtual hosts.

You do not have different domains.

test.com and test.com/blog are the same domain.

Similarly

test.local and test.local/blog are the same domain

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