Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues

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-31-2003, 08:52 PM   PM User | #1
Dalziel
Regular Coder

 
Join Date: Nov 2002
Posts: 161
Thanks: 2
Thanked 0 Times in 0 Posts
Dalziel is an unknown quantity at this point
.htaccess

I want to use .htaccess to block hotlinking images, however I want to allow more than one domain to use the images (I have more than one site that I want to use them on) how do you do that?
Dalziel is offline   Reply With Quote
Old 11-02-2003, 12:03 AM   PM User | #2
chrisvmarle
Regular Coder

 
Join Date: Jun 2002
Location: the Netherlands
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
chrisvmarle is an unknown quantity at this point
Haven't tested this, but it should look like this:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !first.domain.com [NC]
RewriteCond %{HTTP_REFERER} !scnd.another.domain [NC]
RewriteRule \.(gif|jpg)$ - [F]

Greetz, Chris
__________________
My Website
010100010011110101110100011011110111000001101000
chrisvmarle is offline   Reply With Quote
Old 11-02-2003, 03:18 PM   PM User | #3
Dalziel
Regular Coder

 
Join Date: Nov 2002
Posts: 161
Thanks: 2
Thanked 0 Times in 0 Posts
Dalziel is an unknown quantity at this point
Quote:
Originally posted by chrisvmarle
Haven't tested this, but it should look like this:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !first.domain.com [NC]
RewriteCond %{HTTP_REFERER} !scnd.another.domain [NC]
RewriteRule \.(gif|jpg)$ - [F]

Greetz, Chris
Thanks, it can be http://www.domain1.com or http://domain1.com I take it both need listing. Also I take it I can add more entries it's not limited to two for any reason is it?
Dalziel is offline   Reply With Quote
Old 11-02-2003, 03:58 PM   PM User | #4
chrisvmarle
Regular Coder

 
Join Date: Jun 2002
Location: the Netherlands
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
chrisvmarle is an unknown quantity at this point
Yes, both need to be listed and it's not limited to just two lines
__________________
My Website
010100010011110101110100011011110111000001101000
chrisvmarle is offline   Reply With Quote
Old 11-24-2003, 06:59 PM   PM User | #5
TEKKY
New to the CF scene

 
Join Date: Nov 2003
Location: Chicago, IL
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
TEKKY is an unknown quantity at this point
I'm curious if a variation of that can be used to block a hyperlink from a foreign site to mine.

Can I re-direct a user coming from a specific site?
TEKKY is offline   Reply With Quote
Old 11-25-2003, 12:30 AM   PM User | #6
Dalziel
Regular Coder

 
Join Date: Nov 2002
Posts: 161
Thanks: 2
Thanked 0 Times in 0 Posts
Dalziel is an unknown quantity at this point
Yes it can, the script is used here to block access to JPG and GIF files, just set it up as HTM, HTML, PHP or whatever the file type is. Sites linking to you will get your 403 (forbidden) page, customise that to whatever you want. If you want to be real smart you could put a $HTTP_REFERER script in and redirect users to different pages depending on where the foreign link was from.

Just out of interest though, why do you want to stop other sites from linking to you?
Dalziel 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 07:01 PM.


Advertisement
Log in to turn off these ads.