Forum Moderators: phranque

Message Too Old, No Replies

allow hotlinking of all files

         

Eddie1506

6:19 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



in .htaccess how to allow all of my files to be hotlinked from any domain? i know how to disable but need someone to rewrite the code for my needs.

TIA

jdMorgan

6:48 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Eddie1506,

Welcome to WebmasterWorld [webmasterworld.com]!

Please see our charter [webmasterworld.com].

You don't need any code to allow hotlinking -- It is the default behaviour to allow all accesses.

If you want to hire someone to rewrite your code, please see our Commercial Exchange [webmasterworld.com] forum.

Jim

Eddie1506

8:37 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



thank you for your wellcome note!

as far as the question is concerned, i thought so my self. i just needed some confirmation. but i also do have the problem with hotlinking files in IE. i obviously accussed .htaccess file without the reason. you see, whenever i hotlink any zip/rar/exe file (images and html work normally) on my server from IE i can't download it. i get an error saying: "IE cannot download myfile.rar from mysite.com. the requested file is either unavailable or cannot be found." but when i click on that file from my web pages it can be downloaded normally. i don't have that kind of problems in Opera and Mozilla FireFox.

Any suggestions?

jdMorgan

9:25 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Eddie1506,

That's pretty strange... In most cases, the problem is just the reverse: files can be downloaded with IE but not with Mozilla or Opera clients. This is because IE often uses the actual content of a file to determine its MIME-type, whereas Mozilla and Opera look for a valid MIME-type header in the server response. So often, we see the situation where a multimedia file downloads fine in IE, but opens a dialog box in other browsers asking "What do you want to do with this file? Open, save to disk, etc." And the reason is that no MIME-type has been associated with that file type on the server, so the server is not returning an appropriate MIME-type header.

This is easily solved in Apache by adding AddType directives, such as

 AddType application/x-rar-compressed .rar 

to .htaccess or httpd.conf to declare the MIME-type header that should be returned with those filetypes.

I'd suggest looking through your .htaccess file to see if .zip-, exe-, and .rar-type files get any special treatment with regard to hotlinking. Also, examine your httpd.conf file for the same thing (or ask your hosting provider to do so).

It might still come down to a MIME-type problem, but I can't really tell.

Jim

Eddie1506

9:45 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



yes! adding AddType line in .htaccess did the trick. thank you!