Mobile app version of vmapp.org
Login or Join
Karen161

: How can i use the HTTP_REFERER to come from a specified domain name I know the HTTP_REFERER method has a security loop, but it most cases it works fine. How can i use it, to limit how a

@Karen161

Posted in: #Php

I know the HTTP_REFERER method has a security loop, but it most cases it works fine. How can i use it, to limit how a user see other pages on my website, instead of just directly clicking on the link or pasting it on the browser. Specifically, i want the referer to only work if the referred url came from the same domain name? And not from another source.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Karen161

1 Comments

Sorted by latest first Latest Oldest Best

 

@Connie744

With Apache, to protect a directory (e.g. your /images directory) something like this in a .htaccess file works:

RewriteEngine On

RewriteCond %{HTTP_HOST};%{HTTP_REFERER} !^([^;]+);http://1(/.*)?$
RewriteRule .* /please_dont_hotlink.html [R]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme