How to Fix 404 Errors in WordPress After Changing Permalinks

If you have changed the permalinks of your WordPress website or your site previously does not have permalinks at all, you could face the 404 Error on your Homepage. This post is to help manage your permalinks and fix the annoying 404 Errors. You will maintain your SEO rankings, in addition to keeping visitors happy.


What is the WordPress 404 Error?

The 404 error is an HTTP response code that occurs when a user clicks on a link to a missing page or a broken link. The hosting server automatically sends the user an error message that says to indicate that the page could not be found. Something like, “404 Not Found”.

The error more common with these scenario:

  • You’ve newly migrated your site to a new host
  • You have changed your post/page slug but haven’t redirected the old URL
  • You don’t have file permission
  • You have opened an incorrect URL
  • You have a poorly coded plugin or theme


What are WordPress Permalinks

In a nutshell, WordPress permalinks are the unique URLs the platform sets for each of your posts and pages. Take these two permalinks, for example:

They both illustrate unique permalink structures. The first uses the blog post's name as its slug, which is the segment of the URL that identifies a unique page. Instead of its name, the second example uses the post's unique ID as its slug.

From a technical standpoint, both URLs work exactly the same. However, it's easy to see that the first approach is much more user-friendly. Not only is it easier to remember, but it also tells visitors what the page is all about. This is known as a “pretty” (as opposed to “ugly”) permalink.

More importantly, using keywords that explain what your page includes also helps search engines determine their purpose. In other words, they're better from an SEO perspective. If you're not using an optimized permalink structure, you're leaving organic traffic on the table.


The 6 Types of WordPress Permalink Structures (And Which One You Should Use)

Before we jump in, it's important to note that if you're running a new WordPress website, you should always set your favorite permalink structure as early as possible. Conventional wisdom suggests locking down your permalink structure within the first six months since your SEO should still be in the growth stage.

On the other hand, if your website has been around for longer than that, you can still change your permalink structure. However, you may impact your search rankings if you don't implement redirects to your new URLs.

With that background info in mind, let's help you identify the best structure for your WordPress website.

1. Plain

We’ve already introduced this permalink structure above. Here's another example to refresh your memory:

As its name implies, this structure is bare-bones. The slug is actually the designed page ID from your database. It doesn't provide you with any information about the page you're visiting. In most cases, you'll want to use a structure that provides users (and search engines) with a bit more to go on.

2. Day and Name

As the name implies, this permalink structure uses your post or page's name and the day of its publication as part of the URL. Here's an example:

The upside of this structure is it lets your users quickly determine how old a particular post is. In some cases, this can help them assess if it's still relevant without having to hunt for a date in the text. You’ll often find news or magazine sites use this structure — essentially, any website creating time-specific content.

On the flip side, dating your posts does have a downside. For example, imagine you have an excellent post that was published two years ago, and it's considered a definitive source of information on a particular topic. Some readers might simply look at the date and think the advice is no longer relevant, regardless of whether that’s true or not.

To be clear, it's always advisable to include the date of publication somewhere within your post, but there's no compelling reason to add it as part of your URL.

3. Month and Name

This permalink structure is almost identical to the one we just covered. The only difference is, it doesn't include the day of publication as part of your post's URL:

From a functional standpoint, we're dealing with the same set of pros and cons as with the Day and Name structure. It can be nice for visitors to ascertain how old your post or page is at a glance, but it can also make some of your content look outdated.

4. Numeric

The Numeric permalink structure shares a lot of similarities with the Plain option. Let's check out an URL using this setting so you can see it in action:

As with Plain permalinks, this setting uses your post's ID as its slug, and it doesn't provide users with any additional information. In this case, you also get a short permalink, but it comes with no other advantages so it shouldn't be your top option.

5. Post Name

Out of all the default WordPress permalink structures, this one is our favorite. It identifies your posts and pages according to their name, which makes for clean and memorable URLs, such as:

The great thing is, you can name your post and pages any way you want and even customize the slugs if those titles get too long. As a rule of thumb, your slug should remain between three to five-words long. That way, it's still short enough for your visitors to remember, and search engines will also be able to easily identify what the post is about.

6. Custom Structure

If you're not sold on any of the structures we've talked about so far, WordPress also enables you to build your own. For example, if you're running a blog, you can set up individual categories for your roundups and reviews and include them in your links. Here's an example of the former:

In practice, WordPress provides you with ten structure tags you can use to build custom permalinks. If you want to know what they are and how to use them, keep reading — we'll cover all the basics in the next section.

Two Ways to Create Custom Permalinks

As we mentioned a minute ago, WordPress offers you a built-in method to create custom permalinks. However, you can also use plugins to achieve similar results if you want a bit more control over the procedure. Let's talk about both methods.

1. Use WordPress' Custom Structure Tags

WordPress enables you to use ten types of structure tags to create custom permalinks. Let's take a minute to get to know them, then we'll see them in practice.

Date Tags — This category includes %year%, %monthnum%, %day%, %hour%, %minute%, and %second%, and they work exactly as you expect them to. Adding any of these tags as part of your permalink structure will include those numbers within your URL.
Post ID and Name — These tags are %post_id% and %postname%, respectively. The former displays the unique ID for any of your posts or pages, while the second shows their full title.
Category and Author — You can add these options using the %category% and %author% tags, respectively.

To use any of these tags, you need to access your dashboard and go to the Settings > Permalinks tab. Once you're in, you can choose any permalink structure you want out of those we talked about earlier. If you want to create your own, select the Custom Structure option at the bottom of the list.

Now, all you have to do is mix and match the structure tags we talked about earlier.

For example, /%category/%post-name/ would result in this URL:

You can use as many or as few tags as you want for your custom permalink structure. However, we recommend keeping things short and avoiding dates if possible, so your content remains evergreen.

When you're ready, remember to save your changes, and that's it!

2. Use the Custom Permalinks Plugin

If you've been using WordPress for a while, you’ll know there are plugins for nearly every scenario you can imagine. Customizing permalinks is no exception. One option is the Permalink Manager plugin.

This tool enables you to customize your post and page's permalink structure and change the URLs of any individual posts a single screen.

To get started, install the plugin, activate it, then navigate to the Tools > Permalink Manager tab. Inside, you'll find a list of all your posts and the option to tweak their permalinks.

The URL Editor tab section also includes tabs for your Pages and Media, which work just the same as the Posts section. When you're done checking out those, move over to the Permastructures tab. There, you can set unique permalink structures for your posts, pages, and media.

As you can see, the plugin also uses WordPress' default structure tags to help you build new permalinks. All you have to do is put them in the order you want and save your changes.

If you're not happy with your new structures, you can always use the Restore to Default Permastructure button below each field. That's pretty much all you need to know to start using the plugin.


Broken Links? Easy Guide to help a resolution:

  • Clear Browser History & Cookies
  • Document all Current Permalink Settings and URLs
  • Make the Necessary Redirects
  • Switch the Permalinks Setting
  • Manually Edit Your .htaccess File
  • Test and Keep Testing
  • Contact us for Assistance


1. Clear Browser History & Cookies

The very first troubleshooting method you need to perform is to clear the browser cache and cookies or try to visit your site incognito. Many times, you may just be faced with a cache problem even the matter no longer exists.


2. Document all Current Permalink Settings and URLs

Having a plan is always a good thing, thus documenting the current permalink settings is one of the things you should do. We recommend doing the following:

Write down or take a screenshot of your WordPress site's current permalink settings. You will need this in the subsequent step;
In case you are using the "default" settings, you will be able to skip steps 3 and 5. That's because WordPress automatically redirects for you. However, you would still need to do steps 3 and 5;
Write down some current URLs to test them later;
Try getting at least 15 URLs. Once you test them and see that they work, you will feel much more confident that everything is okay.


3. Make the Necessary Redirects

By default, WordPress would attempt to redirect any changed/moved content. However, it does not always work, and you should not rely on WordPress for this specific functionality. With that said, there are two easy ways to set up redirects in WordPress:

Use the free Redirection plugin - manage redirects from the WordPress Dashboard. Once the plugin is installed and activated, go to Tools ? Redirection and input the 404 page URL in the Source URL box and the new location in the Target URL box. Keep in mind that since Redirection is a plugin, it would have some influence over your site performance;

Use cPanel - manage your redirects via cPanel. This option is what you should prefer since everything you do is on a server-side level, thus your site performance will not be affected. Also, it means one less plugin to worry about. You would be using the Apache web service, which gives you the third option to use the .htaccess file for setting up redirects, which we address in Step 4.


4. Switch the Permalinks Setting

This is where you go to your WordPress Dashboard > Settings > Permalinks. Then, you need to choose Post Name and click on the button Save Changes. Yes, that's all. After this step, you will get the 404 Error for your old links. We address this in the next step.

5. Manually Edit Your .htaccess File

Now let's get those pesky 404 errors fixed manually. To do that, log in to your server using FTP, and then modify the .htaccess file, located where folders like /wp-content/ and /wp-includes/ are. The easiest thing to do is temporarily making the file writeable by changing the permissions to 666. After that, repeat the original solution.

Make sure that you don't forget to change the permissions back to 660. Your other option is to manually add the following code in your .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

6. Test and Keep Testing

Start testing the URLs that you have written down and make sure they are correctly redirected. You can also search your website in search engines and make sure those URLs redirect properly.


7. Contact Us For Assistance

Finally, if you get into trouble with your effort, contact our customer support department for assistance.


That's it.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Keep Your WordPress Website Updated

Updating your WordPress website is good for its security, content and data integrity and also for...

How to safely disable the WordPress automatic update feature

Beginning from WordPress version 3.7, there were some very exciting features and security...

How to update your WordPress installation

Regular update on your WordPress website is important to keep it safe and secured from attackers...

How to Manage 403 Forbidden Error in WordPress

The 403 forbidden error is one of the most dreadful errors that a WordPress beginner can come...

Automatic Update in WordPress

WordPress will by default update itself when a security or minor release is available. For major...