You are here: Re: Hotlinking to Html pages « HTML « IT news, forums, messages
Re: Hotlinking to Html pages

Posted by Andy Dingley on 02/17/06 14:01

snorkerz@gmail.com wrote:
> I'd like customers to only link to my pages from within the website, ie
> not from links or with direct urls. The only one to allow access from
> outside should be the home page.

Your first sentence is almost meaningless. I assume that what you
really want is

"Any links from the outside world to my site should be redirected to
the homepage"

This is crazy, but fairly possible. It's your site after all.

> I am not sure if .htaccess or javascript is the way to go - could
> anyone offer a suggestion / solution?

..htaccess is definitely the way to go. JavaScript is a bad idea in
several ways and it doesn't solve the oneproblem .htaccess suffers
from.

There are five cases you need to deal with, all based on testing the
HTTP Referer (search for a .htaccess tutorial on the details):

- A referrer from your own site: Do nothing, just let the page be
served.

- A referrer from another site. Redirect to your homepage.

- Any request for your homepage, with any referrer. DO NOT redirect,
otherwise you risk redirection loops.

Now the tricky stuff!

- A blank referrer, because it's a direct access or a bookmark, not a
link. You might think you should redirect here.

- A blank referrer, because the user agent doesn't support them. Do
you redirect (locking such users permanently into a single page of your
site) or do you not redirect (allowing referer-less agents to link
wherever they wish).

The trouble is that you can't tell the last two cases apart, which
means that taking the second approach to case 5 also turns off case 4.
This means that you either have to make the site unusable for
referer-less agents, or you forbid linking from outside but still
permit bookmarking.

Quite honestly the whole idea is a bad one. Locking out linking is bad
enough, but locking out bookmarks is even worse.


Why do dezyners still think that offending users is ever a good idea?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация