Author Topic: How to denied direct access to image?  (Read 23288 times)

0 Members and 1 Guest are viewing this topic.

Offline qazew

  • Pre-Newbie
  • Posts: 7
    • View Profile
How to denied direct access to image?
« on: March 05, 2010, 06:58:16 PM »
Hi, anybody can tell me how I can denied access to url to image on server by.htaccess?

For example? I have url xxx: mygalleryxxx: /details. php?image_id=72 the user can see the image in gallery, but they can see also this picture in the xxx: mygalleryxxx: /data/media/1/pic. jpg
So what I need to insert in the .htaccess that forbidden direct access to xxx: mygalleryxxx: /data/media/1/pic. jpg but allow for xxx: mygalleryxxx: /details. php?image_id=72 ???

Please help!

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: How to denied direct access to image?
« Reply #1 on: March 05, 2010, 08:04:48 PM »
Hi,
    If you are using C-panel then, there is one option for hotlink protection.. you can use it to stop direct access to the images.


Thanks,

Rembrandt

  • Guest
Re: How to denied direct access to image?
« Reply #2 on: March 08, 2010, 05:12:32 AM »
Hi!

Code: [Select]
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/ [NC]
RewriteRule [^/]+.(gif|jpg|png|zip|pano|pdf|txt|mpg|mpeg|mov|js)$ http://www.yourdomain.com/bug.gif [R,L]

the picture "bug.gif" is a substitute image.

mfg Andi

Offline qazew

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: How to denied direct access to image?
« Reply #3 on: March 09, 2010, 12:46:15 PM »
thank you!

Offline Zyk

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: How to denied direct access to image?
« Reply #4 on: March 18, 2010, 01:01:40 PM »
Hi,

what does the

RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/ [NC]

do?

(Antwort am liebsten in deutsch bitte ;) )

Offline Tiburon

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.hintergrundbilder.de
Re: How to denied direct access to image?
« Reply #5 on: March 18, 2010, 01:39:49 PM »
Hi,

what does the

RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/ [NC]

do?

(Antwort am liebsten in deutsch bitte ;) )

Das beschränkt den Zugriff auf das durch die .htaccess geschützte Verzeichnis auf die angegebene Domain, also Deine eigene. Jedem anderen wird das Bild gezeigt welches unter bug.gif abgelegt ist.
----------------------------------

Have a nice Day

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: How to denied direct access to image?
« Reply #6 on: May 26, 2010, 05:55:58 AM »
whre shud i paste this  8O
I'm Back :)

Rembrandt

  • Guest
Re: How to denied direct access to image?
« Reply #7 on: May 26, 2010, 06:03:30 AM »
whre shud i paste this


Hi, anybody can tell me how I can denied access to url to image on server by.htaccess?...

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: How to denied direct access to image?
« Reply #8 on: October 03, 2010, 03:04:50 PM »
Hallo zusammen,

ich würde gerne für meine Galerie ebenfalls das Hotlinking unterbinden allerdings klappt es bei mir nicht.
Die nachfolgenden Varianten habe ich ausprobiert beide mit der gleichen Ernüchterung:

Code: [Select]
http://www.4homepages.de/forum/index.php?topic=26970.0

RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yourdomain\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ templates/Iceberg/theef.png [L]

Hotlinking noch immer möglich Bilder werden angezeigt.
Setze ich als oberste Zeile zusätzlich ein:

Code: [Select]
RewriteEngine On

Werden die Bilder garnicht mehr geladen weder vom korrekten Referer
sowohl als auch von jedem beliebigem Referer.

dann habe ich es hiermit probiert:

Code: [Select]
http://www.4homepages.de/forum/index.php?topic=27005.0

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/ [NC]
RewriteRule [^/]+.(gif|jpg|png|zip|pano|pdf|txt|mpg|mpeg|mov|js)$ http://www.yourdomain.com/bug.gif [R,L]

Das gleiche Ergebnis, es muss mit dem RewriteEngine On zusammenhängen?! Vermute ich...
Oder habe ich in den obigen Beispielen einen Fehler?

Wer kann / möchte helfen?

EDIT:

Nur die Zeile:

Code: [Select]
RewriteEngine On
führt schon dazu das die Bilder nicht mehr geladen werden.
(Mehr stand jetzt testweise nicht in der htaccess.)

Fehlt mir da evtl. mod_rewrite? Ist das nicht standard?

EDIT2:

Nein es ist nicht standard, jedenfall nicht wenn Confixx installiert ist.
Ich habe das mod_rewrite dann mal über die Weboberfläche aktiviert... :)

Es klappt! War zwar ein Selbstgespräch aber hilft ja evtl. jemand anderem.


Gruß Jens
« Last Edit: October 03, 2010, 03:20:49 PM by x23piracy »

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline Boatswain

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Antique photo album
Re: How to denied direct access to image?
« Reply #9 on: April 09, 2012, 06:29:11 PM »
That seems to work but the image in the htaccess link won't show up  :(

http://www.antiquephotoalbum.nl/flowers.jpg

Rembrandt

  • Guest
Re: How to denied direct access to image?
« Reply #10 on: April 09, 2012, 06:48:54 PM »
That seems to work but the image in the htaccess link won't show up  :(

http://www.antiquephotoalbum.nl/flowers.jpg
have you the "flowers.jpg" copy in your root?

Offline Boatswain

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Antique photo album
Re: How to denied direct access to image?
« Reply #11 on: April 09, 2012, 07:09:48 PM »
Yes, I have

only way to show it this test page

http://www.antiquephotoalbum.nl/test.html


Rembrandt

  • Guest
Re: How to denied direct access to image?
« Reply #12 on: April 09, 2012, 07:17:31 PM »
sorry i cannot say where is the problem....

Offline kar76

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: How to denied direct access to image?
« Reply #13 on: January 07, 2014, 05:41:23 PM »
Hello

Happy New Year to all Members :D

I have seen some sites which redirect hotlinks to main image link. So i search google and find someone who told if image id is same as main url link then with the help of cdn you can redirect hotlinks to main content page.

I thinks its not possible with 4images becoz it uses image name but i see that edit images (images.php) mode recognize image name from database (by "Image file contains") and use that content for edit.

I think same must be used for hotlink, recognize image like this "animal_dog_puppy.jpg" from database if hotlinks protected and redirect to image content url.

If this hypothesis possible can someone do it?
I am not coder so i can not do it by myself.

Please help.