How to Understand Why Your Permalinks Are Not Working In WordPress –

How to Understand Why Your Permalinks Are Not Working In WordPress

Lots of site task focus on Search Engine Optimization (SEO), as it can increase your visibility and search ranking. Part of your SEO strategy should be based on your URL structures, although if your permalinks are not working in WordPress, you’ll struggle to dent your traffic figures.

It’s straightforward to know when you have a broken permalink, but what’s not so easy to understand is how to fix it. Most of the time, you’ll have to jump into your server configuration files and make some changes. Though, a quick reset from within WordPress could be all you need.

Over the next few sections, we’ll show you what to do when your permalinks are not working in WordPress. First off, we’re going to talk more about broken permalinks and what they look like.

What a Broken Permalink Looks Like in WordPress

Regardless of the server you use or its setup, broken permalinks all look the same. In most cases, you’ll see that your home page is perfect, while other pages show a 404 error:

For some specific instances – i.e. legitimate URLs that otherwise don’t exist within the site – you could redirect 404 errors to your home page. Though, it’s not a permanent solution in many cases, as you’ll often have an underlying problem that lies undetected.

What’s more, if your permalinks are not working within WordPress, you’ll have no idea unless you browse your site. It could be that your first inkling of a problem is when users send you a notification. This isn’t good for User Experience (UX), nor your reputation.

Why Your Permalinks Are Not Working in WordPress

Slugs and permalinks in WordPress are more of a ‘set-and-forget’ aspect of your site. While you could edit slugs on a post-by-post basis, you set global permalink structures after the initial WordPress install process. The recommended typical practice is to leave them be after this, because it can affect your SEO.

As such, broken permalinks in WordPress are tougher to fix, because you won’t have had direct involvement in breaking them. Instead, there are a few other avenues to explore:

  • If you install a new plugin, or change the settings of the old one, you could make an indirect change to your permalinks. This is especially true for those plugin that hook into your server configuration files.
  • While it’s a small chance, some core, theme, and plugin updates will break your permalinks. This is one of the reasons why you’ll want to have a clean and current backup in place (more of which later).
  • Speaking of which, if you have to use your backup to restore your site, this can also break your permalink structures. This also applies for migrating your site too.

Though, there is one cause for your permalinks not working in WordPress that is more common: A manual edit to your server configuration files. If you decide to tinker with these files, this does the same damage as a conflicting plugin would.

Regardless of the reason for the error, you’ll want to get to work on fixing it. Now you know the causes, you can begin to dig and discover where the problem lies.

What You’ll Need to Fix Your Broken WordPress Permalinks

If you haven’t already twigged, you’re going to need to jump into your server’s core files. Because of this, it’s good to get everything you need, ready to rock and roll. Here’s the checklist of elements you’ll want to have ready:

  • Administrative access to your server, in order to work with its files. In most cases, this won’t need your input – especially if you’re the site owner.
  • Your server credentials, specifically the log in details. You’ll find these in your hosting control panel, or an email from your provider. If you can’t locate the credentials, your host will be able to tell you where they are.
  • A Secure File Transfer Protocol (SFTP) client, such as Cyberduck, FileZilla, or Transmit. Each of these are more than capable of simple file browsing on your server.
  • The skills to use SFTP without causing a problem. It almost goes without saying that you’ll want to know how to use SFTP throughout the whole of this tutorial.
  • A clean, current, and full backup of your website, and possibly server. If you need to restore because of persistent (or introduced) errors, your backup will become the most valuable file you own.

While there are optional tools, such as a text editor, they aren’t necessary. The above list will be all you need to fix your permalinks not working in WordPress.

How to Fix Permalinks That Are Not Working in WordPress

Once you have all of the tools, skills, and services you need in place, you can get to work. Over the next few minutes, we’ll show you how to fix permalinks that are not working in WordPress in the following ways:

  1. We’ll reset the permalinks from the WordPress dashboard, and it takes seconds to do.
  2. You’ll check for incompatibilities with your plugins that may affect your permalinks.
  3. For Apache servers, we’ll show you where to look to fix your permalinks issue.
  4. We’ll also show you the same thing for Nginx servers, as they are just as (if not more) popular.

By the end of the article, you’ll have the right knowledge to make sure you can fix any permalinks-related issue going forward. There’s a lot to get through, so we’ll start within WordPress itself.

1. Reset Your Permalinks Within WordPress

The hope is that a quick reset of your permalinks within the WordPress dashboard will solve any issues you have. It should take seconds, and because it’s a straightforward way to fix your permalinks issue, we recommend doing this first.

To start, head to the Settings > Permalinks page within WordPress:

The WordPress Permalinks page.

For most modern WordPress installs, you’ll have the Post name permalink structure. Though, for now we need to change it on a temporary basis. To do this, check any other radio button. If you want to be ultra cautious about keeping your URL structure intact regardless, you might want to select Custom Structure, and use the /%postname%/ tag:

Adding a custom permalink structure.

Next, save your changes, re-select the original structure (in this case, Post name), then save your changes again. This should trigger the reset of your permalinks, so check out your site and whether you have resolved the issue.

2. Check For Plugin Conflicts and Incompatibilities

The next method to fix your permalinks not working in WordPress is a more straightforward take on a popular step to fix many WordPress problems. Your plugins (of course) affect myriad areas of your site, so much so that a rogue plugin can cause issues with your permalinks.

The standard approach at this stage would be to log into your server through SFTP, but in this case we don’t need to. Instead, head to the Plugins > Installed Plugins page within WordPress:

The Plugins page within WordPress.

On this screen, select every checkbox for each plugin – you can use the global checkbox at the top to save time – and choose Deactivate from the drop-down Bulk Actions menu:

The Deactivate option from the Bulk  actions drop-down menu.

This will turn off every plugin, but also hopefully fix the permalinks issue that affects your site.

Next, enable each plugin in turn until you find that your permalinks don’t work any more. Once you’ve found the plugin, deactivate it again, and revert your site back to the way it was, sans the offending plugin.

At this point, you have a few options:

  • Delete the plugin altogether if you don’t need it any more.
  • Find an alternative, starting at the WordPress Plugin Directory.
  • Contact the developer to let them know and to ask for a fix.

In any case, you’ll want to keep the plugin disabled until you have a resolution, as you won’t want your permalinks to remain broken.

3. Configure Your Apache Server

While they aren’t as popular now as before, Apache servers are still a solid way to host your website. What’s more, they’re straightforward for the average user to manage (which has drawbacks, but that’s for another article).

As such, let’s take a look at a few tasks you can carry out to get your WordPress permalinks working again.

Work With Your .htaccess File to Get Your Permalinks Working Again

Much like toggling different permalink structures within WordPress, you can also reset your .htaccess file of sorts. For the unaware, this is a configuration file that helps your server manage its contents. You can edit it with new instructions, but in this case, we want to disable it (or at least, not let the server use it on a temporary basis).

You can edit the .htaccess file with new instructions, but in this case, we want to disable it (or at least, not let the server use it on a temporary basis).

For this, you’ll want to log into your server using the credentials you got earlier, and your chosen SFTP client. Once you’re in, you’ll want to navigate to the right site. If it’s the only one on your server, this shouldn’t be too hard. Though, for more than one site, look for something with a specific name.

If you can’t see the name of your site, it could be that it’s the primary install for your server. In this case, look for www, root, public_html, or something similar. Your site’s files will be in there.

Once you’re in the right place, look for your .htaccess file. It should be in the most top-level directory:

The .htaccess file within Cyberduck.

While you’re welcome to back this file up, it will stay on your server, but under a different name. To do this, right-click the file, and from the context menu, find the Rename (or similar) option:

Renaming a file within Cyberduck.

This will cause WordPress to skip over the .htaccess file, as if it didn’t exist. From here, you’ll want to reset your permalinks as per the first step in our guide. This will create a brand new .htaccess file on your server, and which point, you can test out whether your permalinks are not working.

If they do work, something within your .htaccess file will be the cause of your permalinks error. You may want to carry out some cut and paste work to find which lines cause the problem, but because you have a brand new .htaccess file ready to go, there may be no need.

Add the AllowOverride Rule to Your Apache config File

For this next tip, you’ll need to be in your server’s root folder. This is the highest level you can access, and be warned that some hosts might not let you do this. As such, if you use a shared server, this isn’t going to be an option for you. However, those who manage the server or use a Virtual Private Network (VPN) can carry out the following.

You’ll know if you’re in the right place because there will be an etc folder. While some servers will have a etc/httpd/httpd.conf path and file, Linux servers may use etc/apache2/apache2.conf:

A server showing the path to an Apache configuration file.

You’ll want to add a rule to the apache2.conf file that enables you to override certain aspects of the server on a per-directory basis. We’re not going to get into the specifics of this one here, as you don’t need to understand the intricacies. However, you’ll want to make sure you back up before you attempt this one.

Back in your SFTP client, navigate to the apache2.conf file, and open it in your text editor. Within, look for the following suite of code:

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

You’ll want to change the AllowOverride None line to AllowOverride All. Once you save your changes, you’ll want to check to see if your permalinks work. If not, you may need to restart the server. This is an advanced technique that uses Secure Shell (SSH) access. We cover this in another article on the blog.

When you’re in your server, enter sudo systemctl restart apache2 to restart it. Because of the complexities of different hosts, you’ll want to speak with them if you encounter any issues. Many hosts have a custom way to access your server, and you’ll want to find the most optimal approach.

4. Configure Your Nginx Server

Nginx is a super-slick racing car compared to Apache’s tin-top Hot Rod. As such, it has lots of fans, and a big market share compared to the competition.

The drawback here is that finding the files you need is more tricky than other server types. It’s still possible though, so we’ll show you how to fix your permalinks not working within Nginx servers.

Find Your Nginx Configuration File

First, you need to find the right configuration file. You may need to consult your host for the exact location on your server here. For us, the file sits in the etc/nginx/site-enabled/ directory, but yours could differ.

Once you’re inside, look for a file called default.conf, or one named after your site – again, consult your host if you need to. Nginx config files use blocks of code to define different rules, and you’ll know if the file is correct because there will be a block that starts with server {.

When you find this block, you can amend it based on whether your site is in the root or a sub-directory.

Amend Your Nginx Configuration File

With the default.conf file open, and your cursor hovering around the server block, look for another indented block, this time for location / . Within, add the following:

try_files $uri $uri/ /index.php?$args;

The full block should be similar to the following:

location / {
            try_files $uri $uri/ /index.php?$args; 
}

This will only apply if your site is in the root directory of your server. If your site is in a sub-directory – maybe it is one of many sites – you’ll want to point the location to that sub-directory:

location /subdirectort/ {
            try_files $uri $uri/ /subdirectory/index.php?$args; 
}

When you save your changes, restart your server using sudo systemctl reload nginx. As with the Apache instructions, you may not be able to do this, in which case talk to your host and ask them to help you out.

Wrapping Up

Your permalinks represent the human-readable way to access posts and pages on your website. If they go wrong, the fallout could bring your site to its knees. Quite often, the first you’ll know about your permalinks not working in WordPress is the high number of 404 errors your users will get.

To fix it, the best case scenario will be to reset your permalinks within WordPress. Though, in lots of other cases, you’ll have to open up your server, and delete (or otherwise amend) files to get things working again. This post should offer the skills and workflows you need to right the ship and carry on sailing.

Is your permalinks not working in WordPress something you have come up against before, or something you experience right now? Share your situations, and any remedial advice, in the comments section below!

Keep reading the article at WPKube. The article was originally written by Tom Rankin on 2021-12-27 06:02:00.

The article was hand-picked and curated for you by the Editorial Team of WP Archives.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

Your email address will not be published. Required fields are marked *

Show Your ❤️ Love! Like Us
Scroll to Top