Portal Home > Knowledgebase > Articles Database > Blocking Access From a Referring URL
Blocking Access From a Referring URL
Posted by Johnny Cache, 06-09-2011, 11:28 PM |
I imagine this can be done by tweaking .htaccess but I couldn't find anything accurate on Google.
I need to block access to a client's website, if it has been called out/referred from a specific outside URL. Can somebody point me in the right direction to make this happen?
Thanks for your help!
-JME
|
Posted by swiftyCMS, 06-11-2011, 11:39 PM |
php
if($_SERVER['HTTP_REFERER']== 'site_you_dont_want_connect_from')
{
header("location: http://www.yahoo.com");
}
use it as a standard include in your headers.
|
Posted by TwineDev, 06-12-2011, 12:07 AM |
Try the following in your root .htaccess file:
If the referrer starts with any of these it will be blocked:
http://www.blockeddomain.comhttp://blockeddomain.comhttps://www.blockeddomain.comhttps://blockeddomain.com
|
Posted by Johnny Cache, 06-14-2011, 10:07 AM |
Good info guys, thanks.
|
Add to Favourites Print this Article
Also Read