How to Change Your Permalink Structure in WordPress
When I moved over to WordPress, I made the mistake of setting up my permalinks to show date and blog post. It’s not a bad idea, it’s better than the default ?p=123. But I have been wanting to make the change for a while now. I have just been too afraid to do it.
I was worried about the redirects and breaking my blog. But on a whim last week, I decided to do it. And I am here to tell you, it’s really easy and I didn’t break the blog!
How to Change Your Permalink Structure in WordPress
If you are running WordPress with the default ?p=123 structure you don’t have to worry. Go ahead and change your permalinks. WordPress will automatically forward to the new structure.
If you are using any of the other permalink structures, you are going to have to add a 301 redirect.
Make the changes to your permalinks on WordPress in the Permalink menu {Settings >> Permalinks}.
Use the WordPress Permalink Generator by Yoast to generate the redirect code needed. Simply fill in the box with your site URL, select your old permalink structure, and press Generate Redirect.
The next page will give you a piece of code to paste into the top of your .htaccess file. It will look something like this:
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ https://agrandelife.net/$4
Copy the redirect code provided and paste it into the top of your .htaccess file. You will find your .htaccess file in your FTP manager of you CPanel. Make sure you make download a backup of your .htaccess file before you make any changes!
If you don’t see your .htaccess file, make sure when you launch your FTP manager, you have “Show hidden files” checked.
This bit of code will redirect all URLs matching the old format to the post title format that I would like to switch to.
It’s that easy! If you run into the white screen of death after adding the code, make sure you put the correct information into the Generator.