Whew! Just went through quite the headache’s worth of trouble trying to optimize my site and I want to save YOU the same trouble. Here’s a walk-through of how to ensure your old links redirect to your new links and nothing else breaks in between! (Note that this tutorial is for self-hosted WordPress blogs.)
You can read through the lessons I learned along the way, or skip straight to the step-by-step.
It started when I read about why you shouldn’t have dates in your permalink structure. This got me thinking and I agreed that most bloggers should strive for timeless content (plus I want more people clicking through from search results). People may be deterred if they see your post is “old” but that doesn’t mean it’s irrelevant to their needs! So, I decided to make the leap from https://maryqin.com/[year]/[month]/[postname]/ to just https://maryqin.com/[postname]/.
That’s easy enough – just go your WordPress admin and find Settings > Permalinks in the lefthand toolbar. Choose the radio button that says “Post Name” as you can see I did here:
Your links are now updated! But if you’re like me, you linked to your blog on other sites using the old URL structure. Users who click on that would get taken to your homepage and not to the post in question, so they are likely to get confused and leave. We don’t want those linkbacks to be wasted, now do we?! This is where a 301 redirect comes in. I was told to get the “Simple 301 Redirects” plugin but I found that it only worked if I input every redirect I wanted individually. The method for doing a “mass redirect” just wasn’t working, so despite the warnings against the “Advanced Permalinks” plugin, I decided to give it a shot.
I had actually found that plugin on my own before reading up on tutorials and I probably should have just gone with it from the start. Oh well, at least I’ve figured it out now! Once I activated Advanced Permalinks, I went back to Settings > Permalinks and there were some new options available. I couldn’t figure it out on my own, so I found an article that helped me understand what to do. I went to Migration up top and put in “/%year%/%monthnum%/%postname%/” (my old permalink structure) and BAM my links were redirecting to the new ones. Only later did I notice that my categories had broken!!
Sooo it was back to troubleshooting. I managed to figure out that it was indeed this plugin causing the issue, so I looked for a way around it. Luckily, I came across a helpful article in the support forum that showed me a quick recode was all I needed: see steps 5-7 below.
Here is the entire process broken down:
Step 1: Download & activate Advanced Permalinks plugin.
Step 2: Go to Settings > Permalinks and choose “Migration” along the top.
Step 3: In the “Old Permalink” box, input your old structure, i.e. /%year%/%monthnum%/%postname%/, and click Add.
Step 4: Test links with the old permalink structure to ensure they are redirecting properly. Your categories are likely broken at this point (if not, yay, you’re done!).
Step 5: To fix the broken category links, go to Plugins > Editor and choose Advanced Permalinks in the top right dropdown (it might already be open since plugins are arranged alphabetically).
Step 6: Make sure the file open is “advanced-permalinks/advanced-permalinks.php” and search for “$this->add_filter (‘category_rewrite_rules’);”
Step 7: Add // in front so that you have “//$this->add_filter (‘category_rewrite_rules’);” and click Update File. Done!
Now your links should all be working and the categories won’t be broken. If you run across any other issues, let me know and we can troubleshoot together!
« Prev:Ribbon braiding 365great Day 17: photo challenges:Next »
April 1, 2013 2:40 am
Great tutorial! One point to mention is that WordPress can’t update the htaccess on some websites. You’ll have to do this manually.
The htaccess file is usually located in the WordPress root but may be “hidden” so you’ll need to set your FTP client to show hidden files.
Lorenzo recently posted..How to Fix PHP Fatal Error: Allowed Memory Size of # Bytes Exhausted
April 1, 2013 12:21 pm
In this case I actually didn’t even need to edit the .htaccess file! I did try looking it up as part of my troubleshooting and yes, you can’t edit it via WordPress. I hadn’t realized it would be hidden too, which also caused some confusion. Luckily, I was able to leave that file alone.
laelene recently posted..365great Day 17: photo challenges
April 1, 2013 8:36 pm
Hello would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 completely different web browsers and I must say this blog loads a lot faster then most. Can you recommend a good web hosting provider at a reasonable price? Cheers, I appreciate it!
April 1, 2013 8:58 pm
Haha, sure! I use JustHost (because they bought out my original hosting service called Super Green Hosting). They have a pretty robust plan that I like, but I haven’t used any other service so I can’t really compare. Right now they’re actually having a sale in honor of April Fool’s for just $2.95/mo!