3 回答
TA贡献1842条经验 获得超21个赞
最后!对于正在寻找解决方案的每个人,请执行以下操作:
我想要的站点位于 D:\xampp\htdocs\ikeen。
1) 将此添加到您的 httpd-vhosts.conf:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:\xampp\htdocs"
<Directory "D:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName ikeen.localhost
DocumentRoot "D:\xampp\htdocs\ikeen"
SetEnv APPLICATION_ENV "development"
<Directory "D:\xampp\htdocs\ikeen">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
2) 将此添加到 httpd.conf 的末尾:
<Directory />
AllowOverride none
Require all granted
</Directory>
3) 将此行添加到 Windows 目录中的主机文件
127.0.0.1 ikeen.localhost
4) 最后,这是所有解决方案中都缺少的步骤。将此添加到您的 httpd-ssl.conf,在您的本地主机(通常是 www.example.com)的相同部分之后,将 example.com 更改为本地主机的本地设置,以便整个部分看起来像这样
<VirtualHost _default_:443>
# General setup for the virtual host
DocumentRoot "D:/xampp/htdocs"
#ServerName www.example.com:443
ServerName localhost
ServerAdmin admin@example.com
ErrorLog "D:/xampp/apache/logs/error.log"
TransferLog "D:/xampp/apache/logs/access.log"
# General setup for the ikeen host
DocumentRoot "D:/xampp/htdocs/ikeen"
#ServerName www.example.com:443
ServerName ikeen.localhost
ServerAdmin admin@example.com
ErrorLog "D:/xampp/apache/logs/error.log"
TransferLog "D:/xampp/apache/logs/access.log"
TA贡献1796条经验 获得超7个赞
我遇到过同样的问题。通过删除标准虚拟主机条目解决了问题,我没有被重定向到根目录。
只需删除这些代码行:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:\xampp\htdocs"
<Directory "D:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
TA贡献1805条经验 获得超9个赞
如果这种情况不起作用,也许更改 httpd-ssl.conf
我的 3 个网站有效,localhost、test1.com、test2.com
#
<VirtualHost _default_:443>
DocumentRoot "c:/xampp/htdocs"
ServerName localhost
ServerAdmin admin@example.com
ErrorLog "c:/xampp/apache/logs/error.log"
TransferLog "c:/xampp/apache/logs/access.log"
...
</VirtualHost>
#test1
<VirtualHost _default_:443>
DocumentRoot "c:/xampp/htdocs/test1"
ServerName test1.com
ServerAdmin admin@example.com
ErrorLog "c:/xampp/apache/logs/error.log"
TransferLog "c:/xampp/apache/logs/access.log"
...
</VirtualHost>
#test2
<VirtualHost _default_:443>
DocumentRoot "c:/xampp/htdocs/test2"
ServerName test1.com
ServerAdmin admin@example.com
ErrorLog "c:/xampp/apache/logs/error.log"
TransferLog "c:/xampp/apache/logs/access.log"
...
</VirtualHost>
- 3 回答
- 0 关注
- 135 浏览
添加回答
举报