.htaccess on a Mac web server

So, my first tech tip of this new blog.

I installed WordPress and customized a theme to match the rest of this site. (I used to do Enchanter.net entirely in hand-written HTML, but then I decided to “get with the times” and try using a template-based site-generation tool to do the work for me. In hindsight, I should have just continued to write the HTML by hand.) Everything went smoothly, but there was one hitch.

WordPress has a “Permalink Settings” page where I can change the URLs of my blog posts from something boring – “https://www.enchanter.net/ao/?p=123” – to something more trendy like “https://www.enchanter.net/ao/2013/04/sample-post/“. Problem is, to enable this, I had to either use a .htaccess file with some rewrite rules in it, or else modify the server’s httpd.conf with the rewrite rules.

There was much gnashing of teeth as I tried to figure out how to get this to work.

Long story short. My server is a Mac mini running Mac OS Server 10.8, and it turns out that I had three sets of Apache config files on it: the standard files in /etc/apache2, the set in /opt/local/apache2/conf that came with the latest Apache I had installed with MacPorts, and the “real” set in /Library/Server/Web/Config/apache2 that the operating system uses by default. Changes in either of the first two locations go unnoticed by the server (because I never actually switched my config to use my MacPorts version of Apache). Now, there’s a lot of stuff in /Library/Server/Web/Config/apache2; it’s a pain to understand. .htaccess is disabled by default, and I couldn’t find where in there to enable it. As a last resort I decided to go looking in the Server app that configures the whole mess. I didn’t have high hopes, because the Server app seems to dumb-down a lot of the configuration – I am left craving a better way to set up my spam filters, for example. (More about this later.)

However, this time, it had exactly what I needed. Websites -> Edit Advanced Settings -> Allow overrides using .htaccess files. I turned that on, my server immediately started paying attention to the .htaccess file that made WordPress able to handle fancy URLs, and now I am happy!

Well, for now, at least.

webserver-advanced-settings

Leave a Reply

Scroll to Top