3 回答

TA貢獻(xiàn)1833條經(jīng)驗(yàn) 獲得超4個(gè)贊
在您的.htaccess文件(在Web目錄內(nèi))中嘗試以下操作:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# Explicitly disable rewriting for front controllers
RewriteRule ^app_dev.php - [L]
RewriteRule ^app.php - [L]
RewriteCond %{REQUEST_FILENAME} !-f
# Change below before deploying to production
#RewriteRule ^(.*)$ /app.php [QSA,L]
RewriteRule ^(.*)$ /app_dev.php [QSA,L]
</IfModule>

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超4個(gè)贊
為了提高惠斯勒格雷格的答案,我添加了一行,以使bundles文件夾不損壞。這將確保外部資源(例如圖像)不會(huì)損壞。
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# Explicitly disable rewriting for front controllers
RewriteRule ^/web/app_dev.php - [L]
RewriteRule ^/web/app.php - [L]
# Fix the bundles folder
RewriteRule ^bundles/(.*)$ /web/bundles/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
# Change below before deploying to production
#RewriteRule ^(.*)$ /web/app.php [QSA,L]
RewriteRule ^(.*)$ /web/app_dev.php [QSA,L]
</IfModule>
添加回答
舉報(bào)