hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Apache rewrite question
Reply

Forum Jump

Apache rewrite question

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old
Junior Guru
 
Join Date: Dec 2002
Location: Dallas, TX
Posts: 210

Apache rewrite question


When people view images directly off my server (example url below), how can I have it so they are redirected to my homepage?

http://www.example.com/example.jpg

__________________
My Name is Joe!
ICQ: 280 889 133



Sponsored Links
  #2  
Old
Aspiring Evangelist
 
Join Date: Apr 2004
Location: Australia
Posts: 419
Code:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/hotlinking-allowed
RewriteRule ^.*$ - [L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png)$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !underscorebleach\.net [NC]
RewriteCond %{HTTP_REFERER} !bloglines\.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.*) /view_image.shtml?/$1
Or just read this handy tutorial that i found via google: http://underscorebleach.net/jotsheet...taccess-apache

  #3  
Old
Junior Guru
 
Join Date: Dec 2002
Location: Dallas, TX
Posts: 210
Thanks, I'll test it out tonight and see if it works.

__________________
My Name is Joe!
ICQ: 280 889 133

Sponsored Links
  #4  
Old
Web Hosting Master
 
Join Date: Aug 2005
Location: Canada
Posts: 838
That rule can be written like this.

Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png)$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !(underscorebleach\.net|bloglines\.com|google\.|search\?q\=cache)  [NC]
RewriteRule !^/*hotlinking-allowed  view_image.shtml?%{REQUEST_URI}
Also, I would simply serve blank data rather than wasting server resources for the leeching traffic.
RewriteRule !^/*(hotlinking-allowed|blank.txt) blank.txt [L]

Reply

Related posts from TheWhir.com
Title Type Date Posted
Microsoft Gains Most Websites in May Netcraft Web Server Survey Web Hosting News 2014-05-09 11:38:05
Apache Market Share Falls in Netcraft October Web Server Survey Web Hosting News 2013-10-04 14:34:11
Apache Market Share Dips Slightly in June Netcraft Web Server Survey Web Hosting News 2013-06-06 13:40:21
Researchers Urge System Admins to Check for New Apache Web Server Backdoor Malware Web Hosting News 2013-05-01 11:35:53
CloudStack 4.0 Open Source Cloud Software Released as Apache Incubator Project Web Hosting News 2012-11-08 13:54:10


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?