Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > .htaccess question...

.htaccess question...
Thread Tools
Fresh-Faced Recruit
Join Date: Dec 2003
Location: MD, USA
Status: Offline
Reply With Quote
Apr 7, 2005, 03:00 PM
 
Hello hello,

Recently, I created a .htaccess file for one of my websites, to prevent hotlinking, as there have been a number of hotlinking issues in the past.

Recently, I discovered that I'd forgotten something: There's a directory called /banners/ that I use for their banner exchanges. Now, those images are showing up as broken in the banner exchanges. Below is my .htaccess file, placed in the root of their site. Any help so as to allow all the GIF and JPG/JPEG files in the /banners/ directory would be of great appreciation.

Code:
ErrorDocument 404 /404.php RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?theirdomain.com/.*$ [NC] RewriteRule \.(gif|jpg)$ - [F]
Thanks again for the help (in advance).
-Nitz

*************************************
* iBook G3 900mhz/640mb/12.1"/40gig
* 30gig iPod 3rd Gen.
*************************************
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Apr 7, 2005, 04:53 PM
 
I've just woken up so I can't get my brain to remember the specifics, but I do remember that the .htaccess files are inherited on a per-directory basis, and that a child can easily override its parent.

So if you can add the directives to turn off rewriting to a .htaccess file within that specific directory you should be able to achieve what you want.

Hope that helps
Computer thez nohhh...
     
Fresh-Faced Recruit
Join Date: Dec 2003
Location: MD, USA
Status: Offline
Reply With Quote
Apr 8, 2005, 09:56 AM
 
Figured it out. In the root of the site, here's the .htaccess:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !domain\.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule \.(gif|jpe?g|png|psd)$ - [F,NC,L]
For any directory which I want to ignore the root's rules, I drop this .htaccess file into it:

RewriteEngine on
RewriteRule ^.*$ -
Thanks much for the assistance.
-Nitz

*************************************
* iBook G3 900mhz/640mb/12.1"/40gig
* 30gig iPod 3rd Gen.
*************************************
     
   
Thread Tools
Forum Links
Forum 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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:24 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2