簡體   English   中英

配置Symfony3 URL

[英]Config Symfony3 URL

我使用的是Debian服務器,我想用isAdress/register更改URL ipAdresse:9999/app.php/register isAdress/register

我已經成功刪除了.../web/... 但不是.../app.php/...

我有一個虛擬主機:

Listen ipAdress:9999

<VirtualHost ipAdress:9999>
        DocumentRoot "/var/www/SuperSwungBall/web"
        DirectoryIndex app.php


        <Directory "/var/www/SuperSwungBall/web">
                AllowOverride All
                Allow from All
        </Directory>
</VirtualHost>

在〜/ web中有一個.htaccess:

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

我也嘗試使用默認的symfony〜/ web / .htaccess。 但是,它不起作用。

謝謝 !

本文介紹了幾個有關如何配置您的網絡服務器以使用干凈的URL通過app.php路由所有請求的示例: http : //symfony.com/doc/2.8/cookbook/configuration/web_server_configuration.html

在您的情況下,您的虛擬主機應類似於:

<VirtualHost *:9999>    
    DocumentRoot /var/www/SuperSwungBall/web
    <Directory /var/www/SuperSwungBall/web>
        AllowOverride None
        Order Allow,Deny
        Allow from All

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

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

    <Directory /var/www/SuperSwungBall/web/bundles>
        <IfModule mod_rewrite.c>
            RewriteEngine Off
        </IfModule>
    </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