htaccess protect只索引文件,不索引其他文件

htaccess protec ONLY Indexes files but not the rest

本文关键字:文件 索引 其他 protect htaccess      更新时间:2023-09-26

我试图使一个列表与热链接文件,但问题是。htaccess只保护文件,如php html htm,它不与文件,如css js png等工作。即使使用命令丹尼,允许也不行。例如,在我的htaccess中,我有这样的代码

<Files demo.php>
Order deny,allow
Deny from all
Allow from 111.111.111.111 localhost
</Files>
<Files demo.js>
Order deny,allow
Deny from all
Allow from 111.111.111.111 localhost
</Files>

我改变我的IP,当我打mydomain.com/demo.php工作,我的意思是我得到403禁止。但是如果我打mydomain.com/demo.js它不工作。我的意思是,我仍然看到demo.js同样的事情发生时,我试图保护一个js文件。热链接也不行

RewriteEngine on
RewriteCond %{HTTP_REFERER} !http://mydomain'.com/.* [NC]
RewriteRule ^.*js$ - [F]

是否存在我不知道的apache错误配置?提前感谢

看起来你在apache之前有一个前端服务器,它提供静态文件(js, css,图像等)您应该在前端配置中限制对这些文件的访问。