Jump to content

Please Help! How do I redirect malicious visitors that come from a...


Recommended Posts

Ok, I am going to make this the least complicated I can here. I would be SO grateful if someone could help me out here...

 

I want the following TWO things to be happening in my .htaccess file.

 

1) If visitor arrives at any page of my site from baddomain.com, I want him to be redirected to a *SPECIFIC* page on my site where I can gather his IP address. (The specific page will then whisk him back off to baddomain.com via a meta redirect)

 

2) If a malicious visitor that has a particular IP address comes to any page on my site, I want him to be redirected a *DIFFERENT SPECIFIC* page on my site that would be a fake 404 page.

 

Here is the code I have so far, but I believe I have some syntax and logic problems with it. I'm rather new to .htaccess files. What I have below doesn't work for both instances.

 

Options +FollowSymlinks

RewriteEngine on

# Internally rewrite visitors referred by badsite.com to special page

#RewriteCond %{HTTP_REFERER} badsite\.com

#RewriteCond %{REQUEST_URI} !^/ipcapture\.html$

#RewriteRule .* http://www.mydomain.com/ipcapture.html

#

#Code to rewrite visitors with malicious IP addresses

RewriteCond %{REMOTE_ADDR} 111\.11\.11\.111

RewriteCond %{REQUEST_URI} !^/new-courses\.html$

RewriteRule .* http://www.mydomain.com/fake404.html

 

I think that is the clearest I can put it.... if you can help, I would be very happy, and could finally sleep tonight.

 

THANK-YOU!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.