01-17-2004, 02:38 PM | #1 (permalink) |
The GrandDaddy of them all!
Location: Austin, TX
|
Referral URL
I'm hosting some files on some space and I only want that file to be downloaded if it's being referred from a page.
reason is that i dont want people hotlinking that file. is this easy to do?
__________________
"Luck is what happens when preparation meets opportunity." - Darrel K Royal |
01-17-2004, 02:52 PM | #2 (permalink) |
Upright
|
If it's being hosted on a unix machine, you can use apache's mod_rewrite to put some directives in your .htaccess file. Here's a generator for making a .htaccess file that blocks hotlinking.
http://www.htmlbasix.com/disablehotlinking.shtml If it's windows and IIS, I don't know how to do it, but I know it'll be a bit tougher. |
01-17-2004, 04:21 PM | #3 (permalink) |
The GrandDaddy of them all!
Location: Austin, TX
|
i'm not that advanced.
i use frontpage to make the site and the site is hosted on a provider for me. i just upload the files from frontpage.
__________________
"Luck is what happens when preparation meets opportunity." - Darrel K Royal |
01-17-2004, 04:31 PM | #4 (permalink) |
Loves my girl in thongs
Location: North of Mexico, South of Canada
|
Dude,
Is your hosting on linux or MS? When you ftp in, do you start in a home directory like / or /www? When you log on via ftp, the prompt box should scroll through some things after password is accepted. Amongst this is usually some idication of the system OS. Unix systems us a file called .httaccess that's invisable in the main directory (that / or /www). You won't see it in your ftp window but it's there. There are great tutorials on .htaccess on the net that will show you how to add one line to the file that will do exactly this. you can create a file called htaccess.txt, add the code you want to it, then upload it and rename it to .htaccess via ftp. Here's a semi-fictional example from my site of what the file should look like: Code:
.htaccess AddType x-mapp-php4 .php3 ErrorDocument 400 http://www.arch13.com/400.php ErrorDocument 403 http://www.arch13.com/403.php ErrorDocument 404 http://www.arch13.com/404.php ErrorDocument 500 http://www.arch13.com/500.php adding lines of code into this will tell the system whom to allow access to. You can define it by IP address or referer.
__________________
Seen on an employer evaluation: "The wheel is turning but the hamsters dead" ____________________________ Is arch13 really a porn diety ? find out after the film at 11. -Nanofever Last edited by arch13; 01-17-2004 at 04:46 PM.. |
01-17-2004, 04:45 PM | #6 (permalink) | |
Loves my girl in thongs
Location: North of Mexico, South of Canada
|
Bingo,
did a little digging through my refrences and found some lines that fit your need perfectly! LINK Read the tutorial, change the variables to your domain and the file extensions you need, and add those lines of code (but leave the empty line between .htaccess and the other lines!) Good luck Post back if you need more help. Edit: You can also use this for non-apache linux servers (i don't know what 1and1 is using) Code:
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://YOURSITE.COM/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://WWW.YOURSITE.COM/.*$ [NC] ReWriteRule .*\.(gif|jpg)$ - [N,F,L] Quote:
__________________
Seen on an employer evaluation: "The wheel is turning but the hamsters dead" ____________________________ Is arch13 really a porn diety ? find out after the film at 11. -Nanofever Last edited by arch13; 01-17-2004 at 04:52 PM.. |
|
Tags |
referral, url |
|
|