vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   Hotlink Protection Tutorial (Apache Server - .htaccess files) (https://vborg.vbsupport.ru/showthread.php?t=122057)

NeutralizeR 10-03-2006 05:42 AM

Sorry, my mistake: it is post #5. I'm sleepy at the moment, hope i understood you correct:

Code:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainguest1.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainguest1.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainguest2.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainguest2.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainguest3.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainguest3.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf)$ http://www.domain.com/nohotlinking.jpe [R,NC]


Lionel 11-03-2006 01:54 PM

And how do you deal with attachment.php?

This is what they are stealing from me. htaccess does not protect that

NeutralizeR 11-03-2006 04:55 PM

Quote:

Originally Posted by Lionel
And how do you deal with attachment.php?

This is what they are stealing from me. htaccess does not protect that

If guests can't view/download attachments, they won't be able to view/download your attachments on an external site. If you want to test it, just logout and click the link on the external site.

Lionel 11-03-2006 10:05 PM

Guest are allowed to see attachments. But I found a solution that works perfect for me. Attachment.php displays on my site only.

HostileAdam 11-26-2006 05:18 PM

How would i make it so that a certain file is allowed to be hotlinked, like affiliates for example how would i allow people to hotlink my link button? and then the rest of the .gifs wont be allowed to be hotlinked

puertoblack2003 11-27-2006 01:48 AM

is there something we can use for windows server i know this method don't work that way:confused:

Greek76 01-18-2007 08:50 AM

I added this code to my existing htaccess code obviously replacing the urls with my own and now none of my images are appearing on the forum. No photopost, forum icons ect.. Do you know what might be causing this? Thanks

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.msxlabs.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.msxlabs.org$ [NC]
RewriteRule .*\.(mp3|mpeg|mpg|ram|rm|wma|wav|asx|wmv|avi|mov|z ip|rar|exe)$ http://www.msxlabs.org/forum/ [R,NC]

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.msxlabs.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.msxlabs.org$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf)$ http://www.msxlabs.org/forum/ [R,NC]

NeutralizeR 01-18-2007 09:08 AM

Use this one below:
Code:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf|mp3|mpeg|mpg|ram|rm|wma|wav|asx|wmv|avi|mov|zip|rar|exe)$ http://www.yourdomain.com/forum/ [R,NC]

Change http://www.yourdomain.com/forum/ to anything you want to redirect to...

(a page, a picture with .jpe extension)

aacircle 01-20-2007 11:30 AM

Great tutorial. However my redirect isn't working. Hotlinking is being blocked but it doesn't redirect to our home page.

I use:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.animeonline.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.animeonline.net$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf)$ http://www.animeonline.net/ [R,NC]

You can see a test page at www.myotherdomain.com/test.htm. There is a broken image that should redirect to AnimeOnline's home page. Correct?

Thank you.

NeutralizeR 01-20-2007 12:11 PM

Hi,

Image files are displayed as they are broken with hotlink protection enabled, they can't redirect to another page.

I use one line for any file type to use less server resource:
jpg|jpeg|gif|png|bmp|swf|mp3|mpeg|mpg|ram|rm|wma|w av|asx|wmv|avi|mov|zip|rar|exe

If they link a zip file pointing to your domain, it redirects to your homepage if somebody clicks on it. This method doesn't work for image files.


All times are GMT. The time now is 02:34 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02093 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete