- 论坛徽章:
- 0
|
在本地有两个虚拟路径localhost/t/和localhost/js/,配置Apache防止localhost/js/中的代码访问位于localhost/t/下的图片文件
1.配置Apache支持客户端.htaccess文件,打开http.conf,将#LoadModule rewrite_module modules/mod_rewrite.so前的#号去掉
找到Options FollowSymLinks
AllowOverride None 将None修改为All
2.在localhost/t/下新建.htaccess文件,并在其中写入以下内容
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !localhost/t/ [NC]
RewriteRule .(gif|jpg)$ http://localhost/t/error.jpg [R,L,NC]
将其他域名下对图片的访问转向http://localhost/t/error.jpg
在localhost/js/index.php中有一指向localhost/t/1.jpeg的链接,为什么访问localhost/js/index.php的时候还是能显示1.jpeg呢,是哪里的设置出了问题?请高手指点。
|
|