0
使用symfony爲我的網站,我有一個從我的https://www.exemple.com/到https://www.exemple.com/ 302重定向,谷歌不想302重定向...這是重寫部分的最後一個條件.htaccess是這樣做的。。symfony的htaccess使302重定向
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [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>
我試圖把代替:
RewriteRule .? %{ENV:BASE}/app.php [R=301,L]
但在這種情況下,我有一個301重定向,但我的網站是不可達。有任何想法嗎 ?
你有apache模塊'mod_rewrite'嗎?你所描述的是沒有啓用時的行爲...... – Matteo
嗨@Matteo並感謝您的幫助。是mod_rewrite似乎已啓用。 – user3417911