<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Slightlymore &#187; apache</title>
	<atom:link href="http://slightlymore.co.uk/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://slightlymore.co.uk</link>
	<description>The online residence of Clinton the intertube sorcerer</description>
	<lastBuildDate>Sat, 24 Jul 2010 17:11:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-RC2-15161</generator>
		<item>
		<title>How to stop pesky spam by blocking IP addresses from visiting your blog</title>
		<link>http://slightlymore.co.uk/how-to-stop-pesky-spam-by-blocking-ip-addresses-from-visiting-your-blog/</link>
		<comments>http://slightlymore.co.uk/how-to-stop-pesky-spam-by-blocking-ip-addresses-from-visiting-your-blog/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 20:08:02 +0000</pubDate>
		<dc:creator>Clinton Montague</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache / Servers]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[akismet]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://slightlymore.co.uk/?p=341</guid>
		<description><![CDATA[I had a lot of spam from a particular IP *cough* <a href="http://www.projecthoneypot.org/ip_194.8.75.149" target="_blank">194</a>.<a href="http://private.dnsstuff.com/tools/whois.ch?ip=194.8.75.149" target="_blank">8</a>.<a href="http://www.stopforumspam.com/ipcheck/194.8.75.149" target="_blank">75</a>.<a href="http://www.rc411.com/forum/archive/index.php/t-7035.html" target="_blank">149</a> *cough* so I wanted to stop access to the site from the IP. Using only 3 lines in my htaccess file, I managed to cut down my spam by 4 an hour!]]></description>
			<content:encoded><![CDATA[<p>Wow, that&#8217;s a long title, but it&#8217;s worth it! This is just a quick blog post really to vent a bit of pseudo-anger.</p>
<h4>The problem</h4>
<p>I have been getting a hell of a lot of spam from a certain IP address, I&#8217;m not one to point fingers, so I won&#8217;t tell you what it is <em>*cough* <a href="http://www.projecthoneypot.org/ip_194.8.75.149" target="_blank">194</a>.<a href="http://private.dnsstuff.com/tools/whois.ch?ip=194.8.75.149" target="_blank">8</a>.<a href="http://www.stopforumspam.com/ipcheck/194.8.75.149" target="_blank">75</a>.<a href="http://www.rc411.com/forum/archive/index.php/t-7035.html" target="_blank">149</a> *cough*</em>. And I&#8217;m talking about 4 or 5 spam comments an hour (which I know, on the grand scheme of things is nothing, but it&#8217;s quite over-whelming for a small time blogger like myself!). So either it&#8217;s a bot, or a person who has an extremely large supply of non-prescription drugs in his garage. Either way, I don&#8217;t want them posting spam comments on my blog. If it&#8217;s a bot, it won&#8217;t really care; if it&#8217;s a real person, f@*% you, if all you can do is post spam comments, then I don&#8217;t want you reading my blog anyway!</p>
<h4>The solution</h4>
<p>I&#8217;m simply going to use my great pal <code>.htaccess</code> to deny access to my site from the spamming IP. I realise that this is not a great solution, after all, it&#8217;s unlikely that you&#8217;ll be able to keep on-top of every single IP address of spammers, but it&#8217;s an insight into the principles, and a great way of getting rid of single troublesome IPs.</p>
<p>So here&#8217;s the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">Order</span> <span style="color: #00007f;">Allow</span>,<span style="color: #00007f;">Deny</span>
<span style="color: #00007f;">Deny</span> <span style="color: #00007f;">from</span> 194.8.75.149
<span style="color: #00007f;">Allow</span> <span style="color: #00007f;">from</span> <span style="color: #00007f;">all</span></pre></td></tr></table></div>

<p>Which is as easy to understand as it looks &#8211; just give it the IP you don&#8217;t want to have access to your site, and tell apache to deny access. This is actually remarkably powerful, you can use it to conditionally serve CSS for different browsers (based on browser string), stop image hot-linking, and much much more.</p>
<h4>Dude, just use Akismet</h4>
<p>Yeah, I know, you&#8217;re right, Akismet is awesome! If you don&#8217;t have it installed on your blog, you should. It checks a huge (and frequently updated) database to see if a new comment looks like spam, and if so, puts it into a spam queue. But I just like to keep on top of my spam queue and keep it empty. So getting rid of this troublesome IP will save me a bit of time and trouble :)</p>
<h4>&lt;/rant&gt;</h4>
<p>Have you had similar spamming IP problems? What were the addresses. Go on, name and shame!</p>
]]></content:encoded>
			<wfw:commentRss>http://slightlymore.co.uk/how-to-stop-pesky-spam-by-blocking-ip-addresses-from-visiting-your-blog/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>mod_rewrite semi tutorial</title>
		<link>http://slightlymore.co.uk/mod_rewrite-semi-tutorial/</link>
		<comments>http://slightlymore.co.uk/mod_rewrite-semi-tutorial/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 19:19:45 +0000</pubDate>
		<dc:creator>Clinton Montague</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache / Servers]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://slightlymore/?p=3</guid>
		<description><![CDATA[Please note!! I have shamelessly stolen this article from my old and (even if I do say so myself) rather boring blog. So please ignore the terrible writing style! I&#8217;ll rewrite this article in the future, but until then, I present you with version 1.0 There are a lot of tutorials out there regarding apache&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><em class="highlight">Please note!! I have shamelessly stolen this article from my old and (even if I do say so myself) rather boring blog. So please ignore the terrible writing style! I&#8217;ll rewrite this article in the future, but until then, I present you with version 1.0</em></p>
<p>There are a lot of tutorials out there regarding apache&#8217;s very powerful mod_rewrite module. They always seem to offer every solution except the one which you want! Here is an example of a mod_rewrite script which I commonly use.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">on</span>
&nbsp;
<span style="color: #adadad; font-style: italic;"># Directories which we allow the browser to see</span>
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_URI} !^/css
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_URI} !^/js
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_URI} !^/uploads
&nbsp;
<span style="color: #adadad; font-style: italic;"># Redirect all other 'directories' to the main php page</span>
<span style="color: #adadad; font-style: italic;"># for it to work out what to do.</span>
<span style="color: #00007f;">RewriteRule</span> ^(.*)$  index.php?/$<span style="color: #ff0000;">1</span> [L]</pre></td></tr></table></div>

<p>There are a few directories which I WANT the browser to be able to access, the images folder for example. There are a lot of directories I DON&#8217;T want the browser to be able to access, and this is where my solution comes into play.</p>
<p>A quick code run-through:</p>
<ul>
<li>Line 1 turns the module on</li>
<li>Lines 4-6 are the directories which the user is allowed to access. In pseudo-code it would look something like this:<br />
<strong>IF</strong> (the url doesn&#8217;t start with /css AND the url doesn&#8217;t start with /js AND the url doesn&#8217;t start with /uploads)<br />
<strong>THEN</strong> do the url rewriting.The scary looking %{REQUEST_URI} is just an apache environment variable.</li>
<li>Line 10 is the &#8216;interesting&#8217; bit. The ^ means that the pattern starts at the beginning of the url, the $ means that the pattern finishes at the end of the url, and the .* means match any charactor any number of times. Because the .* is in parentheses, it is then stored in the variable $1. The next bit is easy, just tell apache where you want to redirect to, in this case /index.php?/whatever/the/url/was.</li>
</ul>
<p>Another great thing about doing it this way is that it&#8217;s not easy to get a 404 error, apache just re-writes the url and passes it to index.php, which we know exists so if the worst comes to the worst, it can always just show the home page.</p>
<p>If you need a bit of bed-time reading, I recommend the <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html">apache documentation</a> on mod_rewrite. There is a GREAT <a href="http://www.ilovejackdaniels.com/apache/mod_rewrite-cheat-sheet/">cheat sheet</a> over at <a href="http://www.ilovejackdaniels.com/">ilovejackdaniels.com</a> (there are also some for PHP, Javascript and the like. Much recommended).</p>
]]></content:encoded>
			<wfw:commentRss>http://slightlymore.co.uk/mod_rewrite-semi-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
