<?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>Josh.st &#187; default site</title>
	<atom:link href="http://josh.st/tag/default-site/feed/" rel="self" type="application/rss+xml" />
	<link>http://josh.st</link>
	<description>Web, English, 中国, and various geekosity</description>
	<lastBuildDate>Sat, 24 Jul 2010 04:47:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Ubuntu, Apache and making mod_rewrite happy</title>
		<link>http://josh.st/2005/03/06/ubuntu-apache-and-making-mod_rewrite-happy/</link>
		<comments>http://josh.st/2005/03/06/ubuntu-apache-and-making-mod_rewrite-happy/#comments</comments>
		<pubDate>Sun, 06 Mar 2005 04:08:13 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[default site]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.joahua.com/blog/2005/03/06/ubuntu-apache-and-making-mod_rewrite-happy</guid>
		<description><![CDATA[The following only applies to the Apache which ships with Ubuntu — so if you’re wondering why your mod_rewrite isn’t working with something else, chances are this won’t be that helpful. I was playing with mod_rewrite in the context of WordPress 1.5 for use as a CMS on a new website, and it basically wasn’t [...]]]></description>
			<content:encoded><![CDATA[<p>The following only applies to the <a href="http://httpd.apache.org/">Apache</a> which ships with <a href="http://www.ubuntulinux.org/">Ubuntu</a> — so if you’re wondering why your mod_rewrite isn’t working with something else, chances are this won’t be <em>that</em> helpful.</p>
<p><img src="/blog/wp-content/2005/03/apacheubuntu.jpg" style="float:left;margin:.5em;" />I was playing with mod_rewrite in the context of <a href="http://wordpress.org/">WordPress 1.5</a> for use as a <acronym title="Content Management System">CMS</acronym> on a new website, and it basically wasn’t working at all.  The module was there, it was enabled, but it was doing absolutely nothing.  I reinstalled Apache manually (from source), and tried to do the painful stuff that goes with that (<acronym title="PHP: Hypertext Preprocessor">PHP</acronym> <code>./configure</code> options, anyone?  <a href="http://www.bluetrait.com/">Some people</a> might be able to do it, but not me!), but gave up in disdain when I realised I had 2 hours to get work done before a meeting and didn’t have a working Apache install to get it working <em>on</em>.  mod_rewrite or not, it was back to the stock install that “sort of” worked.</p>
<p>mod_rewrite wasn’t working for the meeting, but that didn’t really matter… I’ve discovered that I care more about friendly URLs than most other people I’ve ever met in real life!  That evening, I looked at the problem again, and, after trawling through apache2.conf (Ubuntu’s equivalent of httpd.conf — don’t ask why, I don’t think even they know) and talking to <a href="http://www.bluetrait.com/">Michael</a> about it, I discovered that I’d been looking in the wrong place.</p>
<p>It doesn’t matter whether rewrite.conf is in the mods-enabled folder (although it needs to be — but that’s not the issue at hand here) — by default, Ubuntu’s Apache install has a default virtual host setup under “sites-enabled” (actually just a symlink to “sites_available” — this is best practice when creating new vhosts, by the way: stick the config in sites-available and symlink to that from sites-enabled… there are a few reasons for this, which wouldn’t really affect the casual user, but if you were running LOTS of websites off it it’d soon become helpful if you needed to disable websites because of policy violations or billing without actually <em>deleting</em> the configuration.), instead of just the single “real” server.  Okay, this probably makes sense… but for the fact that it didn’t SAY it anywhere, and additionally, despite having support for .htaccess files built into the apache2.conf file, it’s set to do absolutely nothing in the virtual host config “default”.</p>
<p>Basically, to get mod_rewrite to work, load the module by symlinking to mods-available/rewrite.conf in mods-enabled, then set AllowOverride to “all” in sites-available/default in both the root (“/”) container and the /var/www/ container.  Whilst you’re there, it may be a good idea to get rid of the RedirectMatch, simply because it’s annoying… I haven’t, but only because I haven’t bothered to put something in the root of the default site.</p>
<p>This stuff is probably self explanatory to many, but it took me too long to realise it, even with help, and in my trawlings of Google I hadn’t found anything to say how to do it, so there we are.</p>
<p><em>Updated: see comments <a href="/blog/2005/03/06/ubuntu-apache-and-making-mod_rewrite-happy#comment-3599">3</a> and <a href="http://www.joahua.com/blog/2005/03/06/ubuntu-apache-and-making-mod_rewrite-happy#comment-3601">4</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://josh.st/2005/03/06/ubuntu-apache-and-making-mod_rewrite-happy/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
	</channel>
</rss>
