Generic redirects work, but if you need to post new content, you need a little strategy and some regex tricks to open a “hole” for new content.
My vanity site, riceball.com, is being changed to host content about riceballs, so all the posts were moved to this site, technote.fyi. This was simple enough: use a regex to redirect everything. I used the Redirection plugin.
URL regex to match: ^/(.*)$ URL redirects to: http://technote.fyi/$1
I had one exception, which was to an external site:
To make that exception override the generic regex, I set the “Pos”ition to a lower number.
Everything is good, except there’s one article I want to preserve, about riceballs!
Carving Out Space for New Content
This is going to be tricky. There doesn’t seem to be a way to carve out an exception for this URL.
The solution is to change the permalink structure for the site, so this page gets a new permalink. I’ll put all the new posts into /posts/.
Note that changing the permalink affects only the Post URLs (the blog part of the site); it won’t affect the Page URLs.
Then, instead of a single regex redirect for all the articles, create redirects for subdirectories for the old URLs.
The old URLs have these top level subdirectories (written as regular expressions):
^/category/(.*)$ ^/tag/(.*)$ ^/blog/(.*)$ ^/chatter/(.*)$ ^/code/(.*)$ ^/programming/(.*)$ ^/sysadmin/(.*)$
Establish rules to redirect each of those URLs.
Disable the original, generic rule.
This URL should work: National Riceball Day
Then, wait a few hours, or days, for URLs to redirect, and see the 404 errors stack up.
Riceball.com is so old, and has been through so many changes, and different content management systems, that hundreds of stray URLs are still out there.
After catching enough 404 errors to be able to create redirects for most of the site, I’ll convert the redirect rules into redirection rules for mod_rewrite, and put them into the .htaccess file, for faster and less CPU-intensive redirections.