To use .htaccess, you'll need to be on a server running Linux or some other
Unix like operating system, such as FreeBSD, and using server software such as
Apache or another server that supports it. In other words, you can't
use it with Windows NT or other Microsoft OSs. But then again, you really
don't want to be hosted on NT anyway, Linux & Apache make a much better
web server anyway. {;~)
Lastly, you'll need to be on a host that allows you to
use .htaccess to accomplish whatever task you wish to accomplish.
Different hosts have different rules, which they enforce using something
called "the AllowOverrides directive". So if something listed here doesn't
work for you, first check your syntax carefully, then double check that
you are follow the instructions listed below regarding naming and uploading
the file properly. If it sitll doesn't work, check with your host to see
if what you're attempting is allowed. If not, ask them why it's not,
everything on this page SHOULD be allowed by a decent host.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*YOURSITE.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*anothertrustedsite.com/ [NC] RewriteCond %{HTTP_REFERER} !="" RewriteRule /* http://%{HTTP_HOST}/ [R,L]
RewriteEngine onYou need some javascript to set the cookie.
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*YOURSITE.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*cyberavs.com/ [NC] RewriteCond %{HTTP_COOKIE} !(^|(.+;)*)id=valid(;.*|$) RewriteRule /* http://%{HTTP_HOST}/ [R,L]