View Full Version : hotlinking help
bart5986
07-18-2005, 07:30 AM
Right now I have it activated but allowing direct accessing because if I don't the it conflicts with my arcade games.
What I want to know is if I can make a certain folder or file so that it doesnt' allow direct accessing. I think its possible by changing the .htaaccess file but I have no idea how.
Thanks
traction
07-18-2005, 10:27 AM
What you can do is use .htaccess and password protect your folder.
http://tools.dynamicdrive.com/password/
Visit that website and enter in the details and it will create an .htaccess script. Simply place this in notepad and then upload it to your folder.
Hope this helps,
O.
bart5986
07-19-2005, 01:21 AM
well yes, but then can't they copy the password needed then hotlink it giving the password?
miguel
07-19-2005, 01:57 AM
Can you, please, elaborate a bit further on the problem. What is that you want to accomplish: prevent hotlinking (direct inclusion from another location) of images or other files from a certain folder, or to protect/restrict the access to this folder in some other more general way?
traction
07-19-2005, 03:54 AM
well yes, but then can't they copy the password needed then hotlink it giving the password?
How are they going to be able to copy the password if the .htaccess file is held within the folder you have locked? Even if they did have the password they would not be able to access the folder.
As miguel said, what is it you want to accomplish. Stop people using your images on other sites or just to lock a folder on your website so people cant view your images?
Owain.
bart5986
07-19-2005, 04:16 AM
I want to make it so a .exe file has to be downloaded from my site. I need it only for that file nothing else. (its in its own folder)
I was thinking the password thing you mentioned asked for the password then you type it in. if you hotlinked it then told them the password they don't have to visit my site? :/
traction
07-19-2005, 05:17 AM
I might be wrong here but this is what I would try and do.
Place the htaccess file within the folder your exe file is, this will stop people going straight to your folder and downloading the file but will allow them to download the file from your site, if you hotlink protect the folder (have a look in your cpanel and hotlink protect the path "http://www.your-domain.com/the-exe-folder") this will stop people from access the file from out with your site. Then place a link on your website to the exe file. It might be an idea to zip your exe file as some PC's may block a user downloading an exe file as they are seen as virus risks.
Im sure someone else will be able to tell you if this will work or not. If I get a chance I might try it myself later ;)
O.
bart5986
07-19-2005, 07:59 AM
yeah Its already like that. But the problem is I have to allow direct accessing because if I don't then my arcade games don't work.
What I need is to be able to customize the hot linking for that one folder, or something similar.
miguel
07-19-2005, 09:52 AM
In such case, I would suggest that you make two copies of the exe file in question. One of them will be stored in a folder which is free to be accessed from anywhere, but nobody would know it, since you would be using it only for the acrade games that you mention.
Then, you would keep a second copy in a hotlink-protected folder on your site for access from within the site.
Would that work?
bart5986
07-20-2005, 01:21 AM
ok I don't think you get what I mean :(
I have arcade games (swf files) for my forum which need direct accessing on. The hotlinking feature in the cpanel changes the whole site's hotlinking. I want to be able to have direct accessing off for one folder which has the .exe file in there.
miguel
07-20-2005, 01:34 AM
Then, you can disable the hotlinking from cpanel and implement custom hotlink protection via .htaccess files. I would suggest that you check this article out:
http://underscorebleach.net/jotsheet/2004/06/htaccess-prevent-hotlinking
It describes a solution to a problem which is almost identical to yours.
Good luck!
bart5986
07-20-2005, 02:41 AM
ok i'm kinda having trouble customizing it. If you could help me that'll be great. :)
I need http://www.chaoticgaming.net/ to be allowed to hotlink and I want the http referer to be http://www.chaoticgaming.net/ and nothing else. I also want it to be for a .exe file.
thanks :)
traction
07-20-2005, 04:39 AM
Ok, here goes :
create a new folder and place your .exe file in it, this is the file you are going to hotlink protect, the other folder that has your games in it and the exe file in it can not be hotlinked protected as the games need full access to it. This does mean if someone really really really wanted to get there hands on the exe file and they knew it was located in the unprotected folder they could get to it, but this is unlikely to happen.
now create your hotlinking file which will protect your entire site, images and everything.
Open up notepad and enter the following :
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?chaoticgaming.net/.*$ [NC]
RewriteRule \.(gif|jpg|js|css|exe)$ - [F]
Now save that as .htaccess and upload it to your root folder (public_html)
Now in a new notepad enter the following :
RewriteEngine on
RewriteRule ^.*$ -
and save this in a different folder and name it .htaccess again. Now upload this new file to the folder your downloadable .exe file is saved in. That will allow downloading of that file from that folder.
edit: Actually thinking about it, you shouldnt need that bottom section, you want to hotlink your entire site. You will still be able to run your flash programs as long as you are linking to them from within your domain, it simply denies any one else trying to view it via there domain or website.....Im sure someone will tell me if I am wrong :)
Hope this helps.
Owain.
bart5986
07-20-2005, 05:15 AM
umm the .exe file is in its own folder though. i'm trying what you said now though.
Ok it doesn't work. I'll try asking tech support :/
traction
07-20-2005, 08:34 AM
Ye but if you are wanting to make it downloadable you will need to make 2 copies of it, one in the folder it is in just now so the games can use it and the other so you can download it.
Sorry I cant be any more help, I havent had to use hotlinking in this way before but I would be interested to see how you manage it :)
Owain.
bart5986
07-21-2005, 02:17 AM
thats not what I mean :confused:
I want my "arcade" directory (http://www.chaoticgaming.net/arcade/) To have hotlinking enabled with direct accessing on.
I want the rest of my site to have hotlinking enabled with direct accessing off.
Do you get it? the arcade games have nothing to do with the .exe that file is completly seperate.
traction
07-21-2005, 08:42 AM
Hotlinking is a way of stopping others accessing files/folders on your site via a link on their own site. i.e. Placing an image on their site but leaving it on your server.
In your last post you said you wanted
"arcade" directory (http://www.chaoticgaming.net/arcade/) To have hotlinking enabled with direct accessing on.
If hotlinking is enabled then you can not do a direct link from another website but you can access that folder as long as you are accessing it via "http://www.chaoticgaming.net/"
Then you say you want the rest of the site to have hotlinking on and direct access disabled....this is the same thing but just saying it in a different way. As I said, hotlinking stops people from getting direct access to your files or folders. If you want to stop people viewing inside that folder then password protect that folder.
Sorry if this doesnt help but I am getting confussed.
Owain.
bart5986
07-23-2005, 11:15 AM
tech support already tried and they dont know how or its not possible
I suggest you have a look in your cpanel. You will see direct accessing or somethign similar. I wanted with with the box checked, and one with the box not. :)
traction
07-24-2005, 05:53 PM
Ye, I know there is a hotlinking thing in the Cpanel, but I know it would not do what you wanted it to do....oh well, guess its not as easy as it sounds to do.
Sorry I couldnt help..
O.
bart5986
07-25-2005, 06:25 AM
thats ok. :D