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


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

  • 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, 2012 at 16:20

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);

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy