A website question
08-01-2010, 01:20 PM, (This post was last modified: 08-01-2010, 01:36 PM by RichardGv.)
#3
RE: A website question
Hotlink protection does not actually need PHP to work. The most common technique is to judge whether the user is accessing from a correct source by checking the "Referrer" HTTP header. This can be achieved easily by Apache itself:
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\\.)?yoursite\\.com [NC]
RewriteRule \\.(gif|jpe?g)$ /images/hotlink.$1 [L]
(These code are supposed to be added to .htaccess or httpd.conf. The respective hotlink error images need to put on your server. The code came from this article: http://www.dagondesign.com/articles/hotl...-htaccess/ )
Of course, using cPanel hotlink protection is easier, if less customizable. (And I believe cPanel actually do it by writing a .htaccess.)
Gentoo Linux User (w/ fvwm) / Loyal Firefox User / Owner of a Stupid Old Computer - My PGP Public Key

No man is an island, entire of itself; every man is a piece of the continent, a part of the main; if a clod be washed away by the sea, Europe is the less, as well as if a promontory were, as well as if a manor of thy friends or of thine own were; any man's death diminishes me, because I am involved in mankind; and therefore never send to know for whom the bell tolls; it tolls for thee.
-- Devotions Upon Emergent Occasions (1624), John Donn
Reply


Messages In This Thread
A website question - by 903 - 08-01-2010, 10:23 AM
RE: A website question - by Matt - 08-01-2010, 12:31 PM
RE: A website question - by RichardGv - 08-01-2010, 01:20 PM
RE: A website question - by 903 - 08-01-2010, 01:27 PM
RE: A website question - by RichardGv - 08-01-2010, 01:39 PM
RE: A website question - by 903 - 08-01-2010, 02:21 PM
RE: A website question - by HiddenKnowledge - 08-01-2010, 06:59 PM
RE: A website question - by 903 - 08-01-2010, 09:48 PM
RE: A website question - by Zach - 08-01-2010, 10:00 PM
RE: A website question - by Matt - 08-01-2010, 11:06 PM
RE: A website question - by Vanilla - 08-01-2010, 11:24 PM
RE: A website question - by Matt - 08-02-2010, 01:09 AM
RE: A website question - by 903 - 08-02-2010, 03:27 AM
RE: A website question - by 2348z - 08-04-2010, 07:27 AM
RE: A website question - by hit9k9 - 06-12-2011, 09:59 AM
RE: A website question - by mobile69 - 06-22-2011, 06:20 AM

Forum Jump: