Forum Moderators: phranque

Message Too Old, No Replies

hot linking exception rule?

how to?

         

Blue_Wizard

12:29 pm on Mar 16, 2004 (gmt 0)

10+ Year Member



I have hot linking blocked with htaccess on one of my sites but I want to create a directory containing banner images for ads
example
www.mydomain.com/bannerimages/

where anything in that directory can easily be spidered by the advertising services I use to promote the site

is there a way to do that? where the entire site with the exception of that one directory does not allow hot linking

closed

3:53 am on Mar 17, 2004 (gmt 0)

10+ Year Member



Yes.

In the code, you'll just have to check REQUEST_URI, and if the request is for an image in your bannerimages directory, allow the images to be displayed.

Blue_Wizard

5:27 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



not sure I understand what you mean
this is what I currently have in the htaccess file to block hotlinking on my domain

RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif¦jpg¦swf¦mp3)$ - [F]

where do I add the exception and what's the proper syntax is what I was asking. I want to make sure I don't goof up the rest of my htaccess file because it's working so well for everthing else for the first time.

closed

5:54 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



You would add a RewriteCond in between the two lines. You'd pretty much have to convert what I said in my previous post into code that Apache server will eat up.

If you're asking me for code to cut and paste into your .htaccess, I'll have to refer you to this forum's Charter [webmasterworld.com].

You can find the mod_rewrite documentation here [httpd.apache.org], and you can find an intro for beginners here [webmasterworld.com].

Blue_Wizard

6:01 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



That's it! thanks
No I wasn't asking you to code
I just couldn't figure out where to add it.
I had it way further down in the htaccess
and after RewriteRule \.(gif?jpg?swf?mp3)$ - [F]

closed

6:12 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



You're welcome, Blue_Wizard. Glad you were able to figure it out.