|
|
|
|
|

|
FREE DVD - How To Get The Lifestyle Of A Millionaire FAST!
Take this opportunity to spend 3 hours with a young Australian and learn how he went from below zero to a self made millionaire and is determined to help you do exactly the same. As he believes this should have been taught at school
|
| Jewelbird |
|
Joined: 08 Nov 2007 Posts: 1
|
Posted: Fri Mar 28, 2008 7:09 am Post subject: Block linking from a specific website |
| |
Hello!
I want to prevent some url from visiting my site,for example,I want to deny
visitors from http://www.kids-and-teens.ncomn.com.I add following code to my .htaccess file,but it seems I still can download my program from that website
SetEnvIfNoCase Referer "^http://www.kids-and-teens.ncomn.com/" BadReferrer
order deny,allow
deny from env=BadReferrer
Any suggestions |
|
| Back to top |
|
| dovada |
|
Site Admin
Joined: 01 Jun 2004 Posts: 26 Location: Western Australia
|
Posted: Fri Mar 28, 2008 7:39 am Post subject: |
| |
Hi Jewelbird,
Yes there is a simple way of blocking links from another specific website using php code.
Just add the following php code to the very begining of any web page on your website that you want to block the linking to ( usually this is would be the home page ).
You must place this code before the <head> statement or a headers already sent error will occur.
<?php
$refurl = parse_url($_SERVER['HTTP_REFERER']);
$ref = getenv('HTTP_REFERER');
$referer = $refurl['host'];
$word = "ncomn.com";
$pos = strpos($referer, $word);
if ($pos === false){
// here if true - take no further action
}
else {
//Redirect the user back if false - link from website ncomn.com found
header("Location: $ref");
exit();
}
?>
Additionally add the following code to your .htaccess file to make sure the php code is correctly handled by the server.
AddHandler application/x-httpd-php .php .htm .html
The php code basically sends the person who clicks on any link on ncomn.com that points to your website, back to the website page they are currently on at ncomn.com.
By using $word = "ncomn.com"; the test function will cover all pages of the main ncomn.com website and any of its subdomains.
Hope this helps |
|
| Back to top |
|
| Choose Display Order |
|
| User Permissions |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Dovada student scientific calculator - 14 day free trial available now - Download scientific calculator
Dovada alternative energy research - Cool cell phone ring tones - Cell phone ringtones - More forums
Country music $amp; mp3 song information - Video streaming information -
Forums information
Skin Created by: Sigma12 - - Powered by phpBB © 2001, 2002 phpBB Group
|
 |