【问题标题】:Wrong routing or wamp error ?路由错误或 wamp 错误?
【发布时间】:2018-06-02 05:02:40
【问题描述】:

我刚刚开始了一个新的 symfony 项目,但我的 wamp 出了点问题,我不知道这是来自 Wamp、vhost 还是 Symfony。

我希望你能帮助我。

当我想测试我的虚拟主机时,使用 url kingdom/ 我收到此错误 403:

您无权访问此服务器上的 /。 Apache/2.4.23 (Win32) PHP/5.6.25 服务器在王国端口 80

我的 hhtpd-vhost.com 包含

# Virtual Hosts
#

<VirtualHost *:80>
    ServerName localhost
    ServerAlias localhost
    DocumentRoot c:/wamp/www
    <Directory  "c:/wamp/www/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName kingdom
    ServerAlias kingdom
    DocumentRoot c:/wamp/www/Kingdom
    <Directory "c:/wamp/www/Kingdom/">
        Options -Indexes
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
#

在我的主机文件中,我得到了这个

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1           kingdom
#

现在,在我的 app/config/routing.yml 上

user:
resource: "@UserBundle/Resources/config/routing.yml"
prefix:   /user

wos_way_of_shogun:
resource: "@WOSWayOfShogunBundle/Resources/config/routing.yml"
prefix:   /

在我的 WOSWayOfShogunBundle/config/routing.yml

wos_way_of_shogun_homepage:
path:     /
defaults:  
    _controller: WOSWayOfShogunBundle:Default:index 

wos_way_of_shogun_homepage_bis:
path:     /accueil
defaults:  
    _controller: WOSWayOfShogunBundle:Default:index 

无论哪种方式,我仍然收到 kingdom/ 的 403 错误和 kingdom/app_dev.php/accueil 的 404 错误

感谢您的帮助,如果您能看到我在这里缺少的东西...一定很简单但是:(

【问题讨论】:

    标签: symfony wampserver vhosts


    【解决方案1】:

    将 c:/wamp/www/Kingdom 更改为 c:/wamp/www/Kingdom/web

    # Virtual Hosts
    #
    
    <VirtualHost *:80>
        ServerName localhost
        ServerAlias localhost
        DocumentRoot c:/wamp/www
        <Directory  "c:/wamp/www/">
            Options +Indexes +Includes +FollowSymLinks +MultiViews
            AllowOverride All
            Require local
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerName kingdom
        ServerAlias kingdom
        DocumentRoot c:/wamp/www/Kingdom/web
        <Directory "c:/wamp/www/Kingdom/web">
            Options -Indexes
            Order allow,deny
            Allow from all
            AllowOverride All
        </Directory>
    </VirtualHost>
    #
    

    【讨论】:

    • 非常感谢,这让我快疯了 ^^但是 app_dev 在网络中是有道理的......我应该能够自己弄清楚 :( 我是太糟糕了^^还是谢谢。
    猜你喜欢
    • 2012-05-22
    • 1970-01-01
    • 2019-05-19
    • 1970-01-01
    • 2017-09-02
    • 1970-01-01
    • 2018-05-24
    • 2023-03-25
    • 2010-12-26
    相关资源
    最近更新 更多