2014-02-11 47 views
0

我使用這個代碼htaccess的重寫URL中使用的htaccess rewritting給出子域500內部服務器錯誤

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

<IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
</IfModule> 

它工作正常,在example.com/sub,但在sub.example.com它給500 internal server error(除着陸頁)。

我不明白這裏有什麼問題。有時它可能很簡單,任何幫助表示讚賞。

錯誤日誌。

[Tue Feb 11 00:32:51 2014] [11333226] [core:error] [client 122.174.192.156:15900] AH00124: 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. 
[Wed Feb 12 03:03:37 2014] [11333226] [core:error] [client 122.174.232.6:16075] AH00124: 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., referer http://sub.example.com/ 
[Wed Feb 12 03:03:37 2014] [11333226] [core:error] [client 122.174.232.6:16069] AH00124: 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., referer http://sub.example.com/ 
[Wed Feb 12 03:03:37 2014] [11333226] [core:error] [client 122.174.232.6:16079] AH00124: 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., referer http://sub.example.com/ 
[Wed Feb 12 03:03:38 2014] [11333226] [core:error] [client 122.174.232.6:16081] AH00124: 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., referer http://sub.example.com/ 
[Wed Feb 12 03:03:40 2014] [11333226] [core:error] [client 122.174.232.6:16082] AH00124: 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., referer http://sub.example.com/ 

回答

1
<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

這對我的作品改變。

+1

這是一個巨大的幫助。剛剛遇到我的.htaccess錯誤的情況。我在一個子域內工作,所以設置'RewriteBase'至關重要。 +1我的朋友。做得好。 – War10ck

0

你可以試試這個代碼:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^((?!index\.php).*)$ index.php?/$1 [L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
</IfModule> 
+0

仍呈現500內部服務器錯誤...... –

+0

你需要檢查你的Apache error.log中,因爲沒有語法錯誤在這裏。 – anubhava

+0

我無法訪問這些文件... –

0

試試這個:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond %{REQUEST_URI} ^application.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 
<IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
</IfModule> 

assumming是的index.php是你的索引頁。

,並在config.php

$config['index_page'] = ''; 
+0

同樣的結果... –

-1

我有同樣的問題,即使正確編寫.htaccess。花了我一點時間才意識到文件權限是錯誤的。衛生署!

重要提示: PHP文件不能有777權限。如果您嘗試打開具有此權限的PHP文件,則會導致「內部服務器錯誤500」。要解決此問題,只需更改文件的權限爲644或755

相關問題