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 [email protected]
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 [email protected]
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 [email protected]
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 [email protected]
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 [email protected]
ErrorLog "c:/xampp/apache/logs/error.log"
TransferLog "c:/xampp/apache/logs/access.log"
...
</VirtualHost>
- 3 回答
- 0 關注
- 172 瀏覽
添加回答
舉報