homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Grrr, .htaccess question……help please!
Want to let 2 sites share files…..but block all others from leeching

 5:52 pm on Jun 27, 2003 (gmt 0)

Wow this forum is amazing so much info :)

Now here's my question........

I made a .htaccess file and all is good for blocking leeching on "mydomain1.com" but here's the tricky part!

I want to modify the file to >> allow me to have mydomain1.com and mydomain2.com block all outside picture linking, but allow the 2 sites to link pictures between them.

Does this make sense? Basically I want to put my index and html pages on one site(the main site)....and my pictures on another site. And block outside linking to those 2 sites……but allow...it between the 2 sites……?

This is the script I am using now

RewriteEngine On
RewriteCond %{HTTP_REFERER}!^http://www.mydomain1.com [NC]
RewriteCond %{HTTP_REFERER}!^http://mydomain1.com [NC]
RewriteRule [^/]+.(gif¦jpg)$ - [F]

thanks so much



 6:31 pm on Jun 27, 2003 (gmt 0)

It should just be a matter of adding another condition rule:

RewriteEngine On
RewriteCond %{HTTP_REFERER}!^ht*p://(www\.)?mydomain1.com [NC]
RewriteCond %{HTTP_REFERER}!^ht*p://(www\.)?mydomain2.com [NC]
RewriteRule [^/]+.(gif¦jpg)$ - [F]

Also, I used a regular expression to save you from having a line for urls with www and without.

Note: don't forget to change the broken pipe back to a solid one and also be sure to add the space between the second curly brace and the exclamation point.


 6:42 pm on Jun 27, 2003 (gmt 0)

thanks so much! I will try it when I get back home from work in a few hours....and post up my results here.....

thanks again


 1:01 am on Jun 28, 2003 (gmt 0)

awesome its working!

btw: snipped.com

are the sites :)


[edited by: DaveAtIFG at 3:03 am (utc) on June 28, 2003]
[edit reason] No specificics please! [/edit]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved