[英](.Htaccess) Doesn't working at all. Every time fail to prevent direct access from address bar why ?
I'm building a wedding photo hosting site. 我正在建立一个婚礼照片托管网站。 Where I want to Show the Images but not direct access from address by using "view source" and find direct image link.
我想显示图像但不希望通过使用“查看源”直接从地址访问并查找直接图像链接的地方。 I search here a lot.
我在这里搜索很多。 I find solution.
我找到解决办法。
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost:81 [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost:81.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]
Something like this :81 is my port. 像这样的东西:81是我的港口。 I've tried to test in localhost but every time its fail.
我尝试在localhost中进行测试,但是每次失败时都进行测试。 Someone write there that it's may be opening from cache but I cleared cache and then try again Still same problem.
有人在那写到它可能正在从缓存中打开,但是我清除了缓存,然后重试。仍然是同样的问题。 I'm using CodeIgniter/Php and I put that .htaccess file in the Image folder and once in root.
我正在使用CodeIgniter / Php,并将该.htaccess文件放在Image文件夹中,然后一次置于root位置。 What is the problem.
问题是什么。 My root folder is http://localhost:81/Project
我的根文件夹是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.