2017-02-16 77 views
0

我正在使用Wamp Server for Windows。我在www目錄中有一個名爲「tester」的文件夾。一切正常,直到我把我的.htaccess文件放在「tester」文件夾中。這是我的.htaccess文件:.htaccess導致內部服務器錯誤wash

//Stop hotlinking 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost/tester/.*$ [NC] 
RewriteRule \.(jpg|jpeg|cpp|java|c|txt|in|out|exe|o|ico|png)$ localhost/tester/signin.php[R=302,L] 

//Prevent viewing of .htaccess file 
<Files .htaccess> 
order allow,deny 
deny from all 
</Files> 

//Prevent directory listings 
Options All -Indexes 

將.htaccess文件添加到「tester」文件夾後,出現內部服務器錯誤。

服務器遇到內部錯誤或配置錯誤,無法完成您的請求。

請通過[email protected]與服務器管理員聯繫,通知他們發生此錯誤的時間以及您在此錯誤發生之前執行的操作。

有關此錯誤的更多信息可能在服務器錯誤日誌中可用。

的Apache/2.4.23(Win64中)PHP/25年6月5日,在本地主機端口80

回答

2

服務器在.htaccess,意見應與pound sign (#),而不是//評論。

#Stop hotlinking 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost/tester/.*$ [NC] 
RewriteRule \.(jpg|jpeg|cpp|java|c|txt|in|out|exe|o|ico|png)$ localhost/tester/signin.php[R=302,L] 

#Prevent viewing of .htaccess file 
<Files .htaccess> 
order allow,deny 
deny from all 
</Files> 

#Prevent directory listings 
Options All -Indexes 

這適用於我的本地環境。

+0

還有在線的.htaccess驗證程序,如http://www.htaccesscheck.com/,它們顯示上述錯誤。 – Scovetta

相關問題