问答详情
源自:2-4 WAMPServer多站点配置

添加多站点之后出现The requested URL / was not found on this server.

添加多站点之后出现The requested URL / was not found on this server.没有添加多站点之前localhost能进去,加了之后就进不去了。

提问者:借你的大脑用一下 2015-01-06 11:17

个回答

  • 慧眼识天下
    2015-01-11 17:50:20
    已采纳

    试了下。

    在httpd-vhosts.conf中增加下面代码,直接用localhost就能访问。即把localhost也当成一个虚拟站点,其对应的目录即可访问。

    <VirtualHost *:80>

        DocumentRoot "F:/Demo"

        ServerName localhost

    </VirtualHost>

    不知有没有其他方法?

  • /youtjてfeel
    2017-05-23 02:21:47

    我也遇到这个问题了。应该是“httpd-vhosts.conf”的事,但是不知道怎么改,大神给解答一下啊。

  • 那份牵挂给了谁
    2017-03-16 17:29:05

    能告诉怎么解决的吗?我单个站点是可以的,一配置多个站点总是The requested URL / was not found on this server.

  • 慕少5949445
    2016-04-22 20:12:56

    可以了 不错

  • 启文羊习
    2016-03-13 09:23:14

    大神  膜拜

  • MOOC小白
    2016-02-28 09:02:47

    厉害啊

  • 起个名字真难啊__
    2016-01-21 09:48:14

    如果想让127.0.0.1和localhost也能访问根目录的话如下


    <VirtualHost  *:80>

        DocumentRoot "D:/wamp/www/"

        ServerName "localhost"

        DirectoryIndex "index.php"


       <Directory "D:/wamp/www/">

        Options FollowSymLinks

        AllowOverride All

      </Directory>

    </VirtualHost>



    <VirtualHost  *:80>

        DocumentRoot "D:/wamp/www/"

        ServerName "127.0.0.1"

        DirectoryIndex "index.php"


       <Directory "D:/wamp/www/">

        Options FollowSymLinks

        AllowOverride All

      </Directory>

    </VirtualHost>

    windows/system32/drivers/etc/host文件添加

    127.0.0.1       localhost

    这样就把localhost和127.0.0.1不能访问根目录的问题解决了

  • 起个名字真难啊__
    2016-01-21 09:44:57

    虚拟主机配置如下:

    <VirtualHost  *:80>

        DocumentRoot "D:/wamp/www/"

        ServerName "127.0.0.1"

        DirectoryIndex "index.php"


       <Directory "D:/wamp/www/">

        Options FollowSymLinks

        AllowOverride All

      </Directory>

    </VirtualHost>


  • 反思中国
    2016-01-15 12:19:40

    修改完成之后重启一下服务器就可以了!

  • L_M_S
    2015-06-26 16:41:53

    还是不可以啊

  • mans_m
    2015-03-24 16:14:51

    配置多站点之前,我们是单站点,在配置之后,我们的多站点的配置覆盖了之前的单站点的配置,因此把之前那个也当做多站点的一部分配置一下,自然能正常访问了

  • 慧眼识天下
    2015-01-11 17:11:41

    修改什么才能让localhost也能正确地访问?

  • 借你的大脑用一下
    2015-01-06 14:53:15

    改了,刚换了个版本,很多地方都不用修改

  • 黑色小白鼠
    2015-01-06 14:14:45

    windows host  有改吗

  • 楓葉
    2015-01-06 12:09:25

    大神厉害,问题解决了

  • 借你的大脑用一下
    2015-01-06 11:56:03

    test01.com test02.com打开之后是外国网站

  • 借你的大脑用一下
    2015-01-06 11:21:18

    哪地方不对谁能给改下

  • 借你的大脑用一下
    2015-01-06 11:20:41

    DocumentRoot "F:/Demo"


    #

    # Each directory to which Apache has access can be configured with respect

    # to which services and features are allowed and/or disabled in that

    # directory (and its subdirectories). 

    #

    # First, we configure the "default" to be a very restrictive set of 

    # features.  

    #

    <Directory />

        Options FollowSymLinks

        AllowOverride None

        Order deny,allow

        Allow from all

    </Directory>


    #

    # Note that from this point forward you must specifically allow

    # particular features to be enabled - so if something's not working as

    # you might expect, make sure that you have specifically enabled it

    # below.

    #


    #

    # This should be changed to whatever you set DocumentRoot to.

    #

    <Directory "F:/Demo">

        #

        # Possible values for the Options directive are "None", "All",

        # or any combination of:

        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

        #

        # Note that "MultiViews" must be named *explicitly* --- "Options All"

        # doesn't give it to you.

        #

        # The Options directive is both complicated and important.  Please see

        # http://httpd.apache.org/docs/2.2/mod/core.html#options

        # for more information.

        #

        Options Indexes FollowSymLinks


        #

        # AllowOverride controls what directives may be placed in .htaccess files.

        # It can be "All", "None", or any combination of the keywords:

        #   Options FileInfo AuthConfig Limit

        #

        AllowOverride all


        #

        # Controls who can get stuff from this server.

        #


    #   onlineoffline tag - don't remove

        Order Deny,Allow

        Allow from all

        # Allow from 127.0.0.1


    </Directory>