How to Redirect Archives to Pages in WordPress

July 30, 2014

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…

supporting = loving

Since 1999 I've been creating ad-free technical tutorials and essays here. It's a one-person effort that's also my life and livelihood. If it makes your day more livable in any way, please consider supporting the work with a monthly or one-time donation. Your support means a lot to me, and makes all the difference. 🫶🏼