localhost重定向到本地网站之一

时间:2014-06-27 13:04:40

标签: apache virtualhost

我添加到C:/ windows / system32 / drivers / etc / hosts:

127.0.0.1 mywebiste

并在httpd-vhosts.conf中添加:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs/mywebiste"
    ServerName mywebsite
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common

    <Directory "C:/xampp/htdocs/mywebiste">
        Options Indexes FollowSymLinks Multiviews
        Options -Indexes
        AllowOverride None
        Order allow,deny
        allow from all
        #RedirectMatch ^/$ / index.php

        Options +FollowSymLinks
        IndexIgnore */*
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . index.php
    </Directory>
</VirtualHost>

现在,当我想将新网站添加到主机文件和httpd-vhosts.conf时,它会呈现“mywebsite”并且我无法访问该网站,即使我在httpd-vhosts.conf中删除了我的虚拟主机并从中删除了我的条目托管文件它仍然呈现'mywebsite'。我该怎么做才能解决这个问题,我不知道?

2 个答案:

答案 0 :(得分:0)

我相信你需要

NameVirtualHost *:80

在任何<VirtualHost...>行之前

请参阅here

答案 1 :(得分:0)

没关系,你必须重新启动apache才能应用新设置:)抱歉。顺便说一句,它并不适用于NamevirtualHost。