WordPress Permalink Structure

WordPress has become my favorite CMS, due to it’s ease of use for non-technical people (versus Drupal and OctoberCMS, which target gearheads). This makes it a no-brainer as a platform for quick prototyping, as well as allowing normal people to manage and update their websites.

I find the default Permalink structure (categories, dates, etc) to be ugly as sin. I prefer to modify this to just have %hostname% / %post-name% /.

Need help with your WordPress site? I’ve been doing customization and PHP work for 10 years. Just send me an email at owen@in-tuned.com and I’m happy to help!

However, when you change that setting, I was getting an error with 404 URL not found. Weird. A little looking around and I realize that it was using the Apache mod_rewrite to handle this. As such, there were two steps:

  1. Setting the .htaccess directives
  2. Setting the httpd.conf directive for AllowOverride

The .htaccess was a no-brainer; heck, WordPress prints it to the page and tells you to copy it (since your .htaccess should NOT be editable to www-data nor public, but owned by root).

But even with the correct rewrite rules, it wasn’t working. It’s because of the second step – there’s another directive to allow your Apache configuration to actually executive the rewrite. This lives under a <Directory> setting as an AllowOverride directive.

See this stack overflow where this is discussed in depth, including the correct “minimum permissions” model. (Don’t AllowOverride all!)

Tired of problems with Wix and Squarespace? I can create a fully customized website for your business within a couple of hours! Just email me at owen@in-tuned.com.

So the first few times I did this, no problem. Until I set up this blog, where it wasn’t working again. I know my httpd.conf is correct, and so I copied my .htaccess from an existing site. Still no go, but I was getting a weirder error — “index.php not found” even though the permalink should be https://ratm.io/blog/github-is-live/. Weird.

So I just ran a quick diff against what I had versus what WordPress indicated it should be — doh! The “/blog/” slug was the difference. I updated that and voila, permalinks that work.