Forum Moderators: phranque

Message Too Old, No Replies

use a directory at /Web level to prevent hotlinking?

Are there any disadvantages to using this method?

         

zollerwagner

6:17 am on Feb 1, 2003 (gmt 0)

10+ Year Member



Back in Sept 02, CrazyFool posted a suggestion (quoted below) on using a directory at the same level as the /web directory for images to prevent hotlinking.

Are there any disadvantages to doing it this way? What happens when users go to your page from Google or look at your page in Google's cache?

Thanks for any thoughts

==============
<quote>
there is an easier way to avoid hotlinking without using .htaccess files.
your domain name will normally be mapped to a directory (/web or /htdocs or something like that) within your hosting account, and you will normally place images in a subdirectory of this, ie, /web/images/. you will link to the images with <img src="images/filename.jpg" ...

create an images directory at the same level as your /web or /htdocs directory. change your image links to <img src="../images/filename.jpg .... etc. there is no direct web access to this directory so nobody can hotlink. only your web pages and scripts can access the images directory. voila! no more hotlinking and no .htaccess files!

you should do the same with any sensitive files or information that you want to prevent access to.
</quote>

andreasfriedrich

9:51 am on Feb 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One purpose of giving a reference when quoting somebody is to acknowledge their work. This you did. There is, however, a very important further function: Enabling the reader to easily locate and obtain a copy of the statement you refer to. This you did not. I tried very hard to find the thread but couldn´t come up with it. It seems to be unavailable in Google, ATW, and the site search.

My objections to crazyfool´s statement as given in this thread you are referring to still stand. You cannot refer to a directory below the document root from within the URI namespace unless such a directory is mapped to the URI namespace. In any case it would not be below the root of the URI namespace since by definition that is impossible.

You could use a script to access the images but then that script would need to reside within the URI namespace. It would be up to the script to do the access control.

Andreas

Crazy_Fool

7:30 pm on Feb 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sorry, i should have posted a correction to this before but don't think i got round to it. i only used it on windows nt4 using activestate perl and ASP 2.0 scripts. plain html did not work. the server config on the nt4 server may have been different which is why it worked there. it does not work on my win2k or linux boxes.

zollerwagner

8:14 am on Feb 2, 2003 (gmt 0)

10+ Year Member



Thanks, CrazyFool, for the update. Too bad, because it sure would be easier!

As for Andreas's comments. Sure, that would be nice. It was, indeed, hard to find the old thread. I had remembered it but spent an hour searching myself.

And then I couldn't find a way to use the forum to quote the source and the old thread had been closed, so I couldn't just update on the thread. I should have mentioned the thread number. My oversight.

You've brought up a very good point, though, about the site's inadequacies. This forum is wonderfully full of great info, but the search functon is pitiful. It often returns no results where I know there should be some. Maybe it doesn't search on the messages, just the titles? Plus, it needs a good quote function. If it has one, I couldn't find it.

andreasfriedrich

8:27 am on Feb 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is a quote style code [webmasterworld.com], zollerwagner. A link to those codes can be found at the left hand side next to the textarea when writing or editing a message.

Andreas

zollerwagner

9:03 am on Feb 2, 2003 (gmt 0)

10+ Year Member



Ah, yes, that's helpful. But I was looking for a link/button that allows you to quote (and then reduce to its pith) an entry. Some forums offer this function. It gives credit to the original auto and it's totally automatic. It's very convenient and you have to work hard to leave out key info.