XAMPP VirtualHost 重定向到 htdocs

XAMPP VirtualHost Redirects to htdocs

我已经查看了很多关于这个主题的答案,但没有一个对我有帮助。我试图在 XAMPP 中设置多个虚拟主机,但是一旦我在浏览器中输入服务器别名,它就会将我重定向到 XAMPP/dashboard。您能否看看下面的代码并分享您的想法。提前致谢。

httpd-vhosts.conf 文件

NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot "C:/xampp/htdocs/"
  ServerName localhost
</VirtualHost>

<VirtualHost test*:80>
    DocumentRoot "E:/Drive/Dev/test"
    ServerName test
    ServerAlias test
    <Directory "E:/Drive/Dev/test">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

httpd.conf 文件

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

DocumentRoot "C:/xampp/htdocs/"
<Directory "C:/xampp/htdocs/">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

主机文件

127.0.0.1    test

更改 "directory" 标签中的以下行

Order allow,deny
Allow from all

在此

Require all granted

修复了问题。