簡體   English   中英

如何在Symfony2中使用.htaccess刪除/ web?

[英]How to remove /web using .htaccess in Symfony2?

我已經在我的生產服務器上部署了一個Symfony應用程序。 現在,我需要從域名中刪除/ web,並且已經為此尋找了不同的解決方案。 例如,我嘗試過此方法 ,但僅導致500錯誤。 我已經閱讀了許多類似問題的答案,但找不到有效的解決方案。 誰能給我一個線索?

這是我的htaccess文件:

DirectoryIndex app.php

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mydomain.se$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.mydomain.se$
    RewriteCond %{REQUEST_URI} !folder/
    RewriteRule (.*) /web/$1 [L]

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

這對我有用

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

暫無
暫無

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

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