2010-07-01 58 views
0

我在這裏有一個子域,我希望傳遞。subdomain htaccess

here the example of url : http://subdomain.domain.com/login 
and it should point to : http://subdomain.domain.com/index.php/login 

我寫一個簡單的htaccess

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond $1 !^(index\.php|images|robots\.txt|css|javascript) 
RewriteRule ^(.*)$ index.php/$1 [L] 

,但我總是得到500服務器錯誤。任何機構都有想法,我錯了嗎?

感謝您的幫助

回答

1

這是正常的,你去http://subdomain.domain.com/login,重定向到http://subdomain.domain.com/index.php/login,然後http://subdomain.domain.com/index.php/index.php/login等等,因爲你重寫規則總是匹配。

你可以寫'重寫規則^([^ /] *)$的index.php/$ 1 [L]

+0

嗨半徑,我感謝您的幫助,錯誤500消失 但我現在得到404頁。 我已經在我的本地嘗試了它,並且工作得很好。但在服務器它來到404頁面。 – 2010-07-01 18:23:22

+0

你可能在別的地方有什麼問題 – radius 2010-07-01 19:11:36

0

確保Apache的重寫模塊是活動的,你的.htaccess文件有任何重寫規則之前以下行:

RewriteEngine On 
+0

對不起,忘了說我已經在重寫引擎。我將編輯 – 2010-07-01 18:18:28

0

假設你有mod_rewrite啓用,RewriteRule導致無限重定向循環,它超出了重定向的最大數量並導致內部服務器錯誤。

您需要調整您的規則,使其僅重寫一次。例如,這應該工作:

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php/$1 [L]