所有网址都转到web / index.html

时间:2019-02-04 10:44:09

标签: symfony symfony-3.4

无论我使用什么URL,我总是进入web / index.jtml文件。 我不知道为什么,所以我真的不知道我可以给你看的文件。

我从网站的生产版本中获取了文件。

这是我的htaccess

DirectoryIndex app.php

<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]

    # Sets the HTTP_AUTHORIZATION header removed by Apache
    RewriteCond %{HTTP:Authorization} .
    RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]

    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ - [L]

    # Rewrite all other queries to the front controller.
    RewriteRule ^ %{ENV:BASE}/app.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        RedirectMatch 302 ^/$ /app.php/
    </IfModule>
</IfModule>

这是我的security.yaml

安全性:         编码器:             AppBundle \ Entity \ User:                 算法:bcrypt

    providers:
        db_provider:
            entity:
                class: AppBundle:User
                property: username

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        #secured_api:
        #    anonymous: true
        #    stateless: true
        #    guard:
        #        authenticators:
        #            - AppBundle\Security\TokenAuthenticator
        main:
            anonymous: ~
            http_basic: ~
            form_login:
                login_path: login
                check_path: login
                default_target_path: graphic

            logout:
                path: /logout
                target: /login

请告诉我是否有一个我可以显示的文件可以提供实际帮助,因为我真的不知道这里出了什么问题。 我刚刚从FTP上获取了文件,进行了作曲家更新,启动了服务器,然后无论我尝试使用什么url,无论她是否被映射,我总是会访问此website / index.html文件。

感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

更改您的.htaccess

RewriteEngine On
RewriteRule ^(.*)$ web/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]

答案 1 :(得分:0)

实际上我只是忘了在URL中包含app_dev ...我的错。抱歉打扰了。

相关问题