使用lampp在仪表板中配置localhost和virtalhost重定向

时间:2016-11-10 16:53:14

标签: php apache xampp lampp

我正在尝试将虚拟主机配置到/ opt / lampp / htdocs的子目录中。这是httpd-vhost.conf文件:

NameVirtualHost *:80
<VirtualHost localhost:80>
ServerAdmin localhost
DocumentRoot /opt/lampp/htdocs
ServerName localhost
<Directory  /opt/lampp/htdocs>      
    Options All
    AllowOverride All
    Allow from all
</Directory>
</VirtualHost>


<VirtualHost *:80>
# This first-listed virtual host is also the default for *:80
ServerName www.localhostwmf.com
ServerAlias localhostwmf.com
DocumentRoot /opt/lampp/htdocs/wmf
DirectoryIndex index.php
<Directory  /opt/lampp/htdocs/wmf>

    Options All
    AllowOverride All
    Allow from all
</Directory>
</VirtualHost>

我在httpd.conf中取消注释了这一行:

Include etc/extra/httpd-vhosts.conf

我在etc / hosts中添加了以下行:

127.0.0.1   www.localhostwmf.com

但它总是在xampp的仪表板页面重定向我!提前感谢您的回答!

1 个答案:

答案 0 :(得分:0)

我今天早上解决了这个问题,我希望这个解决方案对另一个解决方案有用:

我修改了我的httpd-vhosts.conf文件,如下所示:

B

(我在localhost文档根目录中添加了wmf文件夹)