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.
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.
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:
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.
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:
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.
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:
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.
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:
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:
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.
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:
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:
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:
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.
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.
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:
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:
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.
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
:
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.
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.
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.
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.
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!
SeedProd is one of the elders of the WordPress ecosystem. It's also a bit of…
Really Simple Syndication (RSS) feeds are a vital component of the WordPress ecosystem. They act…
It’s that time of year again when people start revving up their shopping lists, hunting…
If you clicked on this post, I’m guessing you want to find the best solution…
Trying to figure out how to start an online course so that you can share…
Considering using Teachable to create an online course? In our hands-on Teachable review, we'll help…
View Comments
I've been searching for a resolution for this problem for weeks. You gave it to me, it was the "apache2.conf " solution.
thank you.
Do you know where I could look into WP logs about what goes wrong with permalinks?
I have a site where I dont find since a while, where the problem is, I get a "Not Found" error ("The requested URL was not found on this server.") when switching to permalink ("Post name"), I would need some debug output about the permalink construction by WP, I guess this could help me identify the problem.
All the other stuff I already checked in vain. My guess is, that the import I did (after export from a multisite) breaks the permalinks.
Thanks.