簡體   English   中英

Symfony4始終重定向到index.php

[英]Symfony4 redirects always to index.php

我正在嘗試部署我的Symfony 4應用程序。 我從目錄啟動了symfony服務器,它正在監聽

127:0.0.1:888

我的/etc/apache2/sites-enabled/nameofdomain.conf是:

Listen 888
<VirtualHost *:888>
   ServerName domain.com
   ServerAlias domain.com

   DocumentRoot /var/www/html/Project/public
    <Directory /var/www/html/Project/public>
        AllowOverride All
        Require all granted
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ index.php [QSA,L]
        </IfModule>
    </Directory>

    <Directory /var/www/html/Project/public/bundles>
        <IfModule mod_rewrite.c>
            RewriteEngine Off
        </IfModule>
    </Directory>
    ErrorLog /var/log/apache2/domain.com_error.log
    CustomLog /var/log/apache2/domain.com_access.log combined
</VirtualHost>

當我輸入domain:888時,我總是被重定向到domain:888 / index.php /並出現錯誤

找不到“ GET /”的路線

當我輸入domain:888 / correctPath時,出現apache錯誤“未找到”。

我有Apache 2.4.18和Ubuntu 16.04。 您能幫我如何為應用服務嗎?

第一

composer require symfony/apache-pack

然后

<VirtualHost *:888>
    ServerName domain.tld
    ServerAlias www.domain.tld

    DocumentRoot /var/www/project/public
    <Directory /var/www/project/public>
        AllowOverride All
        Order Allow,Deny
        Allow from All
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    # <Directory /var/www/project>
    #     Options FollowSymlinks
    # </Directory>

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM