This may be a niche case but I am just making note for myself. If you ever feel the urge to change the Permalinks setting on your WordPress site, keep in mind you will break any old external links that point to it.. meaning if for years you have publish posts as:
Changing to the more compact form enabled in recent updates, you can get away with a change that will make the sam post link:
Meaning we can clean up a few characters by removing the date/time cruft in the URL. This is fine for our blog, but anyone who has ever linked to that old post will now get some friendly 404 Not Found screen.
There is a fix, and I recently helped Giulia fix this on her blog. Some of her old posts I saw in the ds106 archives such as
were rendered not found as she changed her URL structure to be
I fixed all of her posts in one line of code (or codish) text – the magic is in the .htaccess file on the root of the server. This helps rewrite URLs to be more public pretty- actually wordpress urls look something more like:
where 245 is a database ID. The rules of htaccess allow web urls to be interpreted from how the browser sends them to what the server expects. It allows humans to use readable URLs and machines to use uglier ones.
The one I needed I found via 10 Awesome .htaccess Hacks for WordPress:
RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://gforsythe.ca/$4
The first part instructs the web server to return a permanent redirect (301) to find anything that has the three numbered structure (e.g. yyyy/mm/dd/) and find all the stuff that comes after that (.*) – every set of patters in (…) corresponds to variables we can use in the result– $1 $2 $3 are the year, month, day respectively, and $4 is the string of the url we want to preserve.
Yeah, it looks like gibberish. But it is possible to clean up from a permalink change.
It just takes a magic hat.
The Fixing Permalinks with Some htaccess Magic by CogDogBlog, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.