2016-11-18 49 views
-1

我有代碼.htacces那熟悉的,當你使用笨這樣eror .htacces笨上的Web服務器

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

但它不能正常工作。喜歡這個。 enter image description here 當我刪除這個.htacces時,代碼運行良好。我已經檢查Apache上的mod_rewrite是否啓用。我很困惑,需要幫助,請

+0

什麼是你想與htaccess的呢? –

+0

與htaccess雅顯示此錯誤 –

+0

去檢查服務器日誌文件。 (錯誤信息已經暗示您應該這樣做。) – CBroe

回答

1

試試這個

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteBase /projectname 
RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
</IfModule> 

注:項目名稱是你的根文件夾名稱

+0

仍然無法工作 –

+0

重命名您的htaccess文件並嘗試...然後重新命名爲.htaccess –

+0

http://stackoverflow.com/questions/5205456/htaccess-mod-rewrite-500-internal-server-error –

1

即使你已經啓用了mod_rewrite,還有能夠阻止的.htaccess的設置從工作。

檢查的httpd.conf文件並確保在目錄設置,

AllowOverride None 

改爲

AllowOverride All 

如果您需要更多的細節,只問!我保持這個非常簡短。

1

試試這個在.htaccess

RewriteEngine on 
RewriteBase /ci 
RewriteCond $1 !^(index.php|resources|robots.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

,並在應用/配置/ config.php文件

$config['index_page'] = ''; // make it empty.