我目前有以下代碼將所有請求(文件除外)重定向到index.php,不幸的是我無法讓我的腳本工作,因爲發生了一些奇怪的MIME類型錯誤網址以斜槓結尾。將所有內容重定向到index.php並剝離最後一個斜槓
奇怪的部分是我的代碼輸出與兩個網址相同,但錯誤只出現在/結尾。
所以我在尋找一種方式,它的工作,現在只需withouth的斜線或只是解決MIME類型問題重定向所有請求,但我不知道是什麼原因造成?
<IfModule mod_rewrite.c>
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On
# Redirect /index.php to/(optional, but recommended I guess)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php
RewriteRule ^index.php/?(.*)$ $1 [R=301,L]
# Run everything else but real files through index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1?%{QUERY_STRING} [L]
</IfModule>
謝謝,但不幸的是,這並沒有解決我的問題 –
什麼是不正確的? –
我還有MIME類型問題 –