在 xampp 中创建子域的最好和最简单的方法是什么

What is the best and easy way to create sub domain in xampp

我想创建或添加像 test.localhost.com 这样的本地子域, 你能帮帮我吗

我尝试将此域添加到我的 windows 主机文件

127.0.0.1 test.localhost.com

它显示页面不工作,我该怎么办?

首先我想告诉你 windows hosts 文件只能重定向你指定 IP 地址,但 localhost.com 在 xampp 中默认不打开所以你必须添加localhost.com 手动。

转到 C:\xampp\apache\conf\extra\httpd-vhosts.conf 并将此代码粘贴到页脚。

# FOR test 
NameVirtualHost test:80 
<VirtualHost *:80> 
<Directory "C:/xampp/htdocs/test"> 
    Options FollowSymLinks Indexes 
    AllowOverride All 
    Order deny,allow 
   allow from All 
</Directory> 
ServerName test 
ServerAlias www.test 
DocumentRoot "C:/xampp/htdocs/test" 
</VirtualHost> 

并转到 C:\Windows\System32\drivers\etc\hosts 并像您已经完成的那样使用此代码给出重定向方向。 将此代码粘贴在底部。

127.0.0.1 test