Closed Thread Icon

Topic awaiting preservation: .htaccess question... Pages that link to <a href="https://ozoneasylum.com/backlink?for=25451" title="Pages that link to Topic awaiting preservation: .htaccess question..." rel="nofollow" >Topic awaiting preservation: .htaccess question...\

 
Author Thread
DaveFA
Nervous Wreck (II) Inmate

From: USA
Insane since: Feb 2004

posted posted 04-07-2005 21:13

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]



-----------------------------------
-Dave

Maker of stuff, user of things
-----------------------------------

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 04-08-2005 01:08

Hey DaveFA. I recently went through this too. The problem was that the images were not linked from the root.

I had this:

code:
<img src="../images/myimage.gif">



instead of:

code:
<img src="/../images/myimage.gif">



notice the extra slash at the beginning. After that everything worked. Also, I would suggest taking out the last line of your .htaccess as it may cause problems down the road.

code:
RewriteRule \.(gif|jpg)$ - [F]



just working from past experence and what very knowlegable people have told me

Later,

C:\

DaveFA
Nervous Wreck (II) Inmate

From: USA
Insane since: Feb 2004

posted posted 04-08-2005 16:21

The images work just fine on their website. It's just that there's one directory, /banners/ which I want to be able to hotlink, but can't.

If I was to remove the RewriteRule \. (gif|jpg)$ - [F] rule, I believe that I'd no longer be able to prevent hotlinking through the .htaccess file. I just want a way to leave everything but /banners/ the way is now.

-----------------------------------
-Dave

Maker of stuff, user of things
-----------------------------------

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-08-2005 16:41

hmm.. Not an expert but can't you override .htaccess in each directory?

What if you dropped a .htaccess file with this in it in the banners dir?

code:
ErrorDocument 404 /404.php



RewriteEngine off





.:[ Never resist a perfect moment ]:.

DaveFA
Nervous Wreck (II) Inmate

From: USA
Insane since: Feb 2004

posted posted 04-08-2005 16:53

Figured it out. In the root of the site, here's the .htaccess:

code:
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:

code:
RewriteEngine on
RewriteRule ^.*$ -



Thanks much for the assistance.

-----------------------------------
-Dave

Maker of stuff, user of things
-----------------------------------

« BackwardsOnwards »

Show Forum Drop Down Menu