3 回答

TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超22個(gè)贊
最后!對(duì)于正在尋找解決方案的每個(gè)人,請(qǐng)執(zhí)行以下操作:
我想要的站點(diǎn)位于 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 目錄中的主機(jī)文件
127.0.0.1 ikeen.localhost
4) 最后,這是所有解決方案中都缺少的步驟。將此添加到您的 httpd-ssl.conf,在您的本地主機(jī)(通常是 www.example.com)的相同部分之后,將 example.com 更改為本地主機(jī)的本地設(shè)置,以便整個(gè)部分看起來像這樣
<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貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超7個(gè)贊
我遇到過同樣的問題。通過刪除標(biāo)準(zhǔn)虛擬主機(jī)條目解決了問題,我沒有被重定向到根目錄。
只需刪除這些代碼行:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:\xampp\htdocs"
<Directory "D:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>

TA貢獻(xiàn)1805條經(jīng)驗(yàn) 獲得超9個(gè)贊
如果這種情況不起作用,也許更改 httpd-ssl.conf
我的 3 個(gè)網(wǎng)站有效,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 關(guān)注
- 183 瀏覽
添加回答
舉報(bào)