Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am need to ban this URL to visit my website, but don't know how should I do this?

http://www.skywalkerltd.com/index.php/user-account/pay-per-click/view/66

I'm a new user of Cpanel 11 / Apache / linux Server.

share|improve this question

migrated from stackoverflow.com Apr 1 '12 at 15:54

This question came from our site for professional and enthusiast programmers.

1  
WHat do you mean by ban? Do you want to prevent the above URL from being used? Do you want to prevent your site from being visited from the above URL? –  John Percival Hackworth Mar 31 '12 at 16:20
add comment

2 Answers 2

If you mean that you want to prevent people from visiting your site from that url, you can check for the referrer header and redirect people from that address to another page or whatever you want to do with them.

You can do this in your htaccess file with something like this:

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://www\.example\.com [NC]
RewriteRule \.png http://www.somewhere.com/something.gif [R]

In PHP you can check for a referrer and redirect them with something like this:

<?
$referer = $_SERVER['HTTP_REFERER'];
if ( $referer != "http://first_url" || "http://second_url" || "http://third_url" || "http://fourth_url" ) {
  header('Location: http://desired_url);
  exit;
};
?>
share|improve this answer
add comment

I don't know how to block specific URLs but here's how you can block them using their IP address. Place this in an htaccess file in your root web directory:

Order Deny,Allow
Deny from 119.40.80.26
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.