Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-17-2012, 08:29 PM   PM User | #1
durangod
Senior Coder

 
Join Date: Nov 2010
Posts: 1,177
Thanks: 214
Thanked 31 Times in 30 Posts
durangod is on a distinguished road
rewrite blocks all images

Hi with help on this site we came up with this for me to use to help stop the hotlinking, i am working on the more involved way that Fou Lu suggested but for now this will have to do.

I dont understand why this is blocking all the images on my site home page. Its suppose to just block if someone hotlinks an image or if they try to bring up an image from the site in a url on a browser.


But for some reason when i post this, all the images on my site index dissappear with the dreaded x lol.

This setup worked perfect in my other cPanel because that site is actually an addon domain so the htaccess is not the root htaccess.

But on this site the htaccess is actually the root htaccess so as you can see i had to also add my add on domain to the approval list as well, (which works fine) but i dont understand why the root domain images are getting blocked (the mysitename.com)

PHP Code:

#block images by direct url all sites listed are authorized
RewriteEngine on
RewriteCond 
%{HTTP_REFERER} !^http://(www.)?mysitename.com/      [NC]
#RewriteCond %{HTTP_REFERER} !^http://(www.)?addondomain_sitename.com/      [NC]

#add another site here if you want - all listed are approved
#RewriteCond %{HTTP_REFERER} !^http://(www.)?site2.com/      [NC]
#RewriteCond %{HTTP_REFERER} !^http://(www.)?site3.com/      [NC]

#browsers send blank referrer so block url in browser too
#optional but recommended - allow blank referrer
#RewriteCond %{HTTP_REFERER} !^$

RewriteRule .*.(jpg|jpeg|gif|png|bmp|wmv)$ - [F,NC,L]
#end block 
durangod is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:57 AM.


Advertisement
Log in to turn off these ads.