2017-02-16 49 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