Mod rewrite Code Library

Code Library - Denying IP Address & Useragent

Security
Denying IP Address & Useragent

htaccess code
RewriteEngine on
# This if for denying a specific useragent
# (testing purposes) RewriteCond %{HTTP_USER_AGENT} ^.*Mozilla.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*useragent name here.*
RewriteRule ^.*$ - [F,L]

htaccess code
RewriteEngine on
# This if for denying a specific ip
# (testing purposes) RewriteCond %{REMOTE_ADDR} ^youriphere[OR]
RewriteCond %{HTTP_USER_AGENT} ^ipaddresshere
RewriteRule ^.*$ - [F,L]

home | blog | tutorials | code library

Questions that are answered here:

  • How to deny access to a specific useragent?
  • How to deny access to a specific IP address?
  • How do I make clean urls

Mod Rewrite (Home) | Mod Rewrite Tutorials | Directory | Code Library | Blog | Mod Rewrite Quick Guide

copyright © 2001 - 2010 Webforgers.net
Owned By SEO Uncloaked, LLC
Aggressive Search Engine Optimization
All rights reserved.