Building alexking.org 2.0, part 5: URLs

The obvious change made with URLs on alexking.org was the conversion from the old template system:

/index.php?content=software/wordpress/content.php

to nice clean page URLs:

/projects/wordpress

Since I only had 25 or so pages that used these old URLs, I’ve got the redirects from these URLs to the new ones set up using PHP header directives. This way visitors (from external links or search engine results) end up at the proper place, and search engine spiders pick up the moved location.

Additional redirects are handled at the Apache layer, using Apache’s redirect functionality.

Besides the new clean URLs, I also decided to move some existing URLs around a little. The biggest change here was probably moving all of my software content (open source projects, WordPress goodies, etc.) from /software to /projects.

The main reason for this was the fact that web services like the Use Tasks service don’t fit in the “software” bucket well, but I wanted to be able to have everything in the same place. Using “projects” instead gives me a lot more logical flexibility as to what I can put under this URL.

All of my project URLs are now standardized on hyphenated names (tasks-pro, not taskspro – php-tag-engine, not phptagengine). I had to set up a few redirects for this as well.

I also made a change in the blog and golf blog, using the term ‘topic’ in the URLs instead of ‘category':

/blog/topic/general

instead of:

/blog/category/general

To me, categories are containing elements and you should only be able to place something in a single ‘category’. Since WordPress allows multiple ‘categories’ to be selected for a blog post, and it is functionality I like to use, I had a terminology conflict. Easily fixed. It also makes the URLs a few characters shorter.

The last big change was the abolishment of the ‘www.’ prefix to all URLs here on alexking.org. A find/replace through the WordPress database fixed pretty much everything up, and Google’s webmaster tools allow you to make the global change for your domain really easily for their search results.

A word of advice on URLs: try your best to future-proof them. You really can’t do this, things will come up in the future that make you move them, but it’s a good idea to try anyway. The more you think through your URL structure, the fewer changes you’re likely to have to make in the future. Managing URL changes isn’t terribly difficult, but it is a pain in the arse. Especially when you’re moving s resource for the second or third time. The less often you need to do it, the happier you will be.

When you move your URLs around, you’ll undoubtedly miss a few things. If you’re using WordPress with nice permalinks, your visitors will get nice friendly 404 pages. You can also hook in to those pages create some 404 reports for yourself. I created a little plugin to help me with this, it’ll be available shortly.