簡體   English   中英

(.Htaccess)根本不起作用。 每次無法阻止直接從地址欄訪問為什么?

[英](.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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM