[英](.Htaccess) Doesn't working at all. Every time fail to prevent direct access from address bar why ?
我正在建立一个婚礼照片托管网站。 我想显示图像但不希望通过使用“查看源”直接从地址访问并查找直接图像链接的地方。 我在这里搜索很多。 我找到解决办法。
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost:81 [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost:81.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]
像这样的东西:81是我的港口。 我尝试在localhost中进行测试,但是每次失败时都进行测试。 有人在那写到它可能正在从缓存中打开,但是我清除了缓存,然后重试。仍然是同样的问题。 我正在使用CodeIgniter / Php,并将该.htaccess文件放在Image文件夹中,然后一次置于root位置。 问题是什么。 我的根文件夹是http:// localhost:81 / Project
You can use this..
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
ErrorDocument 404 index.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.