PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
spasticdonkey
Client


Joined: Dec 02, 2006
Posts: 109
Location: Texas, USA

PostPosted: Mon May 07, 2007 6:24 pm Reply with quote Back to top

Well I have setup hotlink protection in .htaccess and it works, but there was one feature I couldnt quite get working. I am trying to substitute an image of my choosing, when someone hotlinks to one of mine

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$      [NC]
RewriteRule .*\.(gif|jpg|mp3|css|js)$ http://www.mysite.com/angryman.gif [R,NC]


Is hotlink protection itself blocking the display of the image? Or have I made a mistake in there somewhere?

Just to warn others, one mistake I made at first was not including the address without the www too. Since my site works either way, I was blocking images from my own site Sad
View user's profile Send private message
persona_non_grata



Joined:
Posts: 0

PostPosted: Mon May 07, 2007 7:31 pm Reply with quote Back to top

this should be enough i think..

RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_URI} !/info/ [NC]
RewriteRule \.(png|gif|jpe?g)$
Only registered users can see links on this board!
Get registered or login to the forums!
[NC,R,L]

the folder info is where to put abuse image...
keep any used image small,prefered a few hundred bytes.
View user's profile Send private message
spasticdonkey
Client


Joined: Dec 02, 2006
Posts: 109
Location: Texas, USA

PostPosted: Thu May 10, 2007 1:57 pm Reply with quote Back to top

thanks I'll give it a try. Still recovering from a total pc meltdown so might be a bit. I also wanted to block
js flv css wmv mp3 files but assume I would do so on another line, like so?
Code:

RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_URI} !/info/ [NC]
RewriteRule \.(png|gif|jpe?g)$ http://www.yoursite\.com/info/abuse.png [NC,R,L]
RewriteRule \.(js|css|flv|wmv|mp3)$ [NC,R,L]


i assume you were breaking the code with the "?" (jpe?g) any other breaks? Also does doing it this way remove the need to list the allowed domains by both
Only registered users can see links on this board!
Get registered or login to the forums!
and yoursite.com ?

also, does this work if you draw the replacement image from another server/domain?

thanks Smile


Last edited by spasticdonkey on Thu May 10, 2007 2:10 pm; edited 1 time in total
View user's profile Send private message
persona_non_grata



Joined:
Posts: 0

PostPosted: Thu May 10, 2007 2:00 pm Reply with quote Back to top

no...the code is like you see it...
long time ago i had to experiment a bit to realy get it working like i wanted..
but you expand it as you like..
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 7339
Location: Arizona

PostPosted: Fri May 11, 2007 6:40 am Reply with quote Back to top

Quote:

i assume you were breaking the code with the "?" (jpe?g) any other breaks


I am not taking over the thread... Wink I just want to explain the above a bit (you cannot take the teacher out of me...):

The "e?", actually, is basically allowing this to match on both "jpg", without the "e" notice, and also "jpeg". That's all.
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum