How to Redirect Archives to Pages in WordPress

Changing your permalink structure on WordPress is non-trivial. It can break your site, orphan your content, and do murder to your SEO.

I have a heap of very old links from Lifehacker and other domains that point to content on my old domain, when I was using an old permalink structure. So I needed to be able to handled those incoming links which are now pointed to my new domain and new permalink structure.

Here’s the code for redirecting /archives/416/ to site.com/?p=416.

location ~ /archives/(.*) {
rewrite ^/archives/(.*)$ https://danielmiessler.com/?p=$1 permanent;
}

Now we wait to see if Google likes these links coming back alive…

Related posts: