<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How do I use htaccess to redirect a bunch IPs to a text file on my server?</title>
	<link>http://ask.metafilter.com/49503/How-do-I-use-htaccess-to-redirect-a-bunch-IPs-to-a-text-file-on-my-server/</link>
	<description>Comments on Ask MetaFilter post How do I use htaccess to redirect a bunch IPs to a text file on my server?</description>
	<pubDate>Thu, 26 Oct 2006 15:50:12 -0800</pubDate>
	<lastBuildDate>Thu, 26 Oct 2006 15:50:12 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How do I use htaccess to redirect a bunch IPs to a text file on my server?</title>
		<link>http://ask.metafilter.com/49503/How-do-I-use-htaccess-to-redirect-a-bunch-IPs-to-a-text-file-on-my-server</link>	
		<description>Using htaccess, I&apos;d like to redirect all requests from a random set of IPs to a text file explaining that the IP has been banned.  What would be the easiest and most efficient way to do this? &lt;br /&gt;&lt;br /&gt; I&apos;m trying to stop splogs and comment spammers from ever reaching my server.  I know I can simply block them using deny, allow rules, but I don&apos;t want to just block -- I want potential innocents to be directed to a note just in case I get overzealous in my blocking.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.49503</guid>
		<pubDate>Thu, 26 Oct 2006 13:30:35 -0800</pubDate>
		<dc:creator>maxpower</dc:creator>
		
			<category>redirect</category>
		
			<category>htaccess</category>
		
	</item> <item>
		<title>By: bachelor#3</title>
		<link>http://ask.metafilter.com/49503/How-do-I-use-htaccess-to-redirect-a-bunch-IPs-to-a-text-file-on-my-server#752136</link>	
		<description>A common way of doing this is:&lt;br&gt;
&lt;br&gt;
&amp;lt;Directory /docroot&amp;gt;&lt;br&gt;
  RewriteEngine  on&lt;br&gt;
  RewriteCond %{REMOTE_ADDR} 10\.0\.0\.3&lt;br&gt;
  RewriteRule ^index.html$ special_index.html  [L]&lt;br&gt;
&amp;lt;/Directory&amp;gt;&lt;br&gt;
&lt;br&gt;
Mind you, this would be used in an httpd.conf file, so in a .htaccess file, you remove the &amp;lt;Directory&amp;gt; tags. The IP address is a regular expression, so you could append the multiple addresses in that line; alternatively, you could use the &quot;[OR]&quot; flag:&lt;br&gt;
&lt;br&gt;
RewriteCond %{REMOTE_ADDR} 192\.168\.0\.1 [OR]&lt;br&gt;
RewriteCond %{REMOTE_ADDR} 192\.168\.10\.5 [OR]&lt;br&gt;
RewriteCond %{REMOTE_ADDR} 192\.168\.100\.50&lt;br&gt;
RewriteRule ^index.html$ special_index.html [L]</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.49503-752136</guid>
		<pubDate>Thu, 26 Oct 2006 15:50:12 -0800</pubDate>
		<dc:creator>bachelor#3</dc:creator>
	</item><item>
		<title>By: Freaky</title>
		<link>http://ask.metafilter.com/49503/How-do-I-use-htaccess-to-redirect-a-bunch-IPs-to-a-text-file-on-my-server#752334</link>	
		<description>Or using the rather more suitable &lt;a href=&quot;http://httpd.apache.org/docs/2.0/mod/mod_access.html&quot;&gt;mod_access&lt;/a&gt;:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;ErrorDocument 403 denied.html&lt;br&gt;
Order Deny, Allow&lt;br&gt;
Deny from 223.32.65.48 252.121.41&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.49503-752334</guid>
		<pubDate>Thu, 26 Oct 2006 18:20:47 -0800</pubDate>
		<dc:creator>Freaky</dc:creator>
	</item><item>
		<title>By: Freaky</title>
		<link>http://ask.metafilter.com/49503/How-do-I-use-htaccess-to-redirect-a-bunch-IPs-to-a-text-file-on-my-server#752356</link>	
		<description>Oops, better make that ErrorDocument:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;ErrorDocument 403 /denied.html&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
Since it&apos;s a URL in that form.  You can also use a string if you like:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;ErrorDocument &quot;Your IP is blocked.  Contact maxpower if you aren&apos;t a dirty rotten spammer.&quot;&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
Using mod_rewrite for this sort of thing is rather like using a sword to spread butter.  It works (mostly), but swords are meant for bigger things, where the benefits outweigh the risk of cutting off an arm because of a misplaced backslash.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.49503-752356</guid>
		<pubDate>Thu, 26 Oct 2006 18:46:11 -0800</pubDate>
		<dc:creator>Freaky</dc:creator>
	</item><item>
		<title>By: jeversol</title>
		<link>http://ask.metafilter.com/49503/How-do-I-use-htaccess-to-redirect-a-bunch-IPs-to-a-text-file-on-my-server#752642</link>	
		<description>You don&apos;t have your website in your profile, and you don&apos;t mention if you are using a package like Wordpress or the like for the site. But, if you are using Wordpress, Drupal, or another PHP-based system, check out &lt;a href=&quot;http://www.homelandstupidity.us/software/bad-behavior/&quot;&gt;Bad Behavior&lt;/a&gt;. It&apos;s done amazing things for the sites I host. What little comment spam I receive is caught by Asimet.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.49503-752642</guid>
		<pubDate>Fri, 27 Oct 2006 05:57:10 -0800</pubDate>
		<dc:creator>jeversol</dc:creator>
	</item><item>
		<title>By: maxpower</title>
		<link>http://ask.metafilter.com/49503/How-do-I-use-htaccess-to-redirect-a-bunch-IPs-to-a-text-file-on-my-server#753476</link>	
		<description>Thanks for everyone&apos;s input.  I&apos;ll check out the suggestions.  I have no problems at all stopping spam on my website.  However, I also have a few splogs that steal via the RSS feed.   As far as I know, IP blocking is the only way to stop these guys.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.49503-753476</guid>
		<pubDate>Fri, 27 Oct 2006 18:21:39 -0800</pubDate>
		<dc:creator>maxpower</dc:creator>
	</item>
	</channel>
</rss>
