Results 1 to 4 of 4
Thread: Apache rewrite question
-
02-27-2006, 04:02 AM #1Junior 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.jpgMy Name is Joe!
ICQ: 280 889 133
-
02-27-2006, 04:55 AM #2Aspiring 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
-
02-27-2006, 12:32 PM #3Junior 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
-
02-28-2006, 09:55 PM #4Web Hosting Master
- Join Date
- Aug 2005
- Location
- Canada
- Posts
- 862
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}
RewriteRule !^/*(hotlinking-allowed|blank.txt) blank.txt [L]