2013-04-06 26 views
2

我在我的網站的子文件夾中開發了一個應用程序,它工作正常。服務器500錯誤 - 在子文件夾中移動的應用程序

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt) 
RewriteRule ^(.*)$ /app/index.php/$1 [L] 
</IfModule> 

此文件是工作的罰款等等,並沒有要求的index.php到應用程序中導航。現在我把該應用程序網站的根目錄,並改變最後一行

RewriteRule ^(.*)$ index.php/$1 [L] 

現在我已經開始讓內部服務器錯誤500.我不知道,這是我做過或.htacces要求配置不同。這也可能是主持人的問題,但我想先排除我的選擇。

任何幫助將不勝感激。提前致謝。

回答

1

如果您在託管的根,你只需要

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt) 
    RewriteRule ^(.*)$ /index.php/$1 [L] 
    </IfModule> 

如果您在文件夾中的網站/foo你需要:

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteBase /foo 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt) 
    RewriteRule ^(.*)$ /foo/index.php/$1 [L] 
    </IfModule> 

如果仍無法正常工作試試這個,對我來說,作品遍佈:

RewriteEngine On 
RewriteBase /foo 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /foo/index.php/$1 [L] 
+0

謝謝你,你是一個拯救生命的人。我總是被困在.htaccess文件中。我認爲學習內部的時間已經到來。 – 2013-04-06 12:46:43

+0

@AmanAujla哈哈我希望有一天,我可以挽救一些生命,無論如何,這些都是簡單的開始的問題,一旦你得到如何工作,這很容易;) – sbaaaang 2013-04-06 12:57:24