2013-07-16 25 views
0

嗨我試圖從url中刪除.php擴展名。爲此,我正在按照本教程remove .php extension。但是,當我的.htaccess文件添加到目錄中,它顯示添加.htaccess使內部服務器錯誤

Internal Server Error 

The server encountered an internal error or misconfiguration and was unable to complete your request. 

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. 

More information about this error may be available in the server error log. 

.htaccess文件是:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/]+)/$ $1.php 
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ 
RewriteRule (.*)$ /$1/ [R=301,L] 

的哪些錯誤?

注意:我正在測試WAMP服務器中的所有文件。

+0

是啓用了mod_rewrite? –

+0

您是否檢查過'apache error log',使用wampmanager菜單來查看它,就像這個'left click wampmanager - > Apache - > Apache error log' – RiggsFolly

回答

0

刪除#之前的下面一行。

編輯

之前
#LoadModule rewrite_module modules/mod_rewrite.so 

後編輯

LoadModule rewrite_module modules/mod_rewrite.so 
1

選項+ SymLinksIfOwnerMatch 行是錯誤的主要原因 請評論它

#Options +SymLinksIfOwnerMatch 

錯誤將刪除

1

爲了解決這個問題,你需要啓用mod rewrite 打開終端並打印sudo a2enmod rewrite 然後重啓apaache ssudo service apache2 restart