(b)log-insert imagen

13/09/2021

2021/09/13#p1
# 0 comments: click to read or leave your own

Inspired by James, I worked out how to do the redirects for old WordPress posts.

Firstly, I wrote a page template that would get the permalink for each post then automatically generate the new permalink for the archive page based on the date and number of posts on that day.

Next, I created a new custom table and (using the above template) automatically wrote all the old & new permalinks to it.

Finally, I added a custom 404 page that checks if the URL matches an entry in that custom table and, if so, redirects to the correct post using the archive page.

This is a WordPress link but, now that I have removed the root WP files, should be captured by the 404 page and redirected to the correct post on the archive page.

I need to do some more work on things, especially for instances where a 404 is generated by something that isn't an old WordPress link. I may also duplicate the permalink pairs for those instances where a post link was hard-coded prior to moving WordPress to a subfolder.

cancelDraft:   Publish: media
Leave a reply



Cancel comment
2021/09/13#p2
# 6 comments: click to read or leave your own

I feel so old. My offspring is old enough to have offspring. And is! That's right, I'm going to be a grandparent — the little bundle of joy is due in March 2022.

Here is baby walker:

Baby Walker

And if that's not enough, here is baby sucking it's thumb:

Sucking thumb

They say good things happen in threes:

  • sold our house ✓
  • got a new job ✓
  • my daughter is bringing a new life into the world ✓

We're all so incredibly happy and have just been waiting for 12 weeks so we can tell everyone.

cancelDraft:   Publish: media
avatar
maique says:Reply to maique

@colinwalker Awwww!! 🥰 Congratulations, Grandpa! Wishing you, and the whole family, all the best.

avatar
Colin Walker replied:

Thanks 🙏 I have, however, said that I'm going to be Pops.

avatar
jean says:Reply to jean

@colinwalker Congratulations! That is awesome. I remember when the first friend of my age cohort became a grandparent, and it was a little mind-blowing. I look forward to being a great aunt someday. That is, I am already a great aunt, but I am pretty sure I will be a great great aunt... 👵🏻

avatar
Colin Walker replied:

It is a little crazy but in a good way 😊

avatar
Chris Lovie-Tyler says:Reply to Chris Lovie-Tyler

That's awesome, Colin. Congratulations.

avatar
Colin Walker replied:

Thanks Chris 🙏

Leave a reply



Cancel comment
Colin Walker
COLOPHON | Content: CC BY-NC 2.0 UK
Colin Walker Colin Walker colin@colinwalker.blog