2016-03-08 133 views
0

我在我的web項目中使用下一個.htaccess文件。今天錯誤500簡單htaccess重定向

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME}% !-d 
RewriteCond %{REQUEST_FILENAME}% !-f 
RewriteCond %{REQUEST_FILENAME}% !-l 



#RewriteLogLevel 9 

RewriteRule \.(css|jpe?g|gif|png|js|ods|odt|doc?x|xls|pdf|eot|svg|ttf|woff|less|xml|gz)$ - [L] 
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] 
here 

這始終是工作得很好,但我的託管服務做了一些改變(我認爲),現在我有我的網頁上一個500錯誤。 我聯繫了他們,他們告訴我,該網站有下一個錯誤日誌。

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 

有人可以告訴我我該怎麼辦才能修復它?我在其他文章中看到,可能我的RewriteRule可能會更好,但我不知道。

謝謝。

PD:對不起,我的英文不好。

回答

0

您的重寫規則無條件地將所有請求重寫爲/index.php,因爲無效的RewriteConds。改變這種行爲只是從測試字符串中刪除「%」:

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-l 



#RewriteLogLevel 9 

RewriteRule \.(css|jpe?g|gif|png|js|ods|odt|doc?x|xls|pdf|eot|svg|ttf|woff|less|xml|gz)$ - [L] 
RewriteRule ^((?!index\.php).+)$ index.php?url=$1 [QSA,L] 
+0

嗨,謝謝你的回答。我做了你所說的,(tecnically複製並粘貼),但然後,網絡顯示我的下一個錯誤: **注意:未定義的索引:網址....在行97 ** **注意:未定義的索引:在....上線100 **, 像** RewriteRule **,現在已被忽略。 Addicionally,如果我把更多東西放在像url.com/something這樣的URL中,服務器顯示404沒有找到錯誤,他沒有重定向到索引。 – jrodriguez