How To Fix Broken Permalinks In WordPress
Are you getting 404 errors when you try to visit pages or posts through their normal links on your WordPress site? This tutorial will show you how to fix broken permalinks in WordPress.
When it comes to a WordPress site, few things are more important than permalinks. They make sure that when a user clicks a link on your page, they actually get to where you want them to go. They make the right content (that WordPress stores in a database) show up nicely depending on what “page” a visitor is on.
Permalinks also keep your links looking nice and clean, rather than some long string of id numbers like: example.com/post.php?id=91824.
Note: If you’re looking to fix permalinks on a local development version of WordPress, you might want to check that you have the RewriteModule function enabled in Apache on your local server software.
Things That Can Break Permalinks In WordPress
There are however, a few things that can break permalinks in WordPress. Let’s take a quick look at them.
1. Installing New Plugins
If you install a new plugin that tries to deal with permalinks, you may enocounter an incompatibility that ends up breaking your permalinks.
Whether you update WordPress core, a plugin or your theme, this can actually break your permalinks if you’re unlucky.
It could for example be the result of an incompatibility between the theme or a plugin and the new version of WordPress, or incompatibilities between the new version of the theme or plugin you updated and other plugins.
3. Migrating Site/Restoring Back Up
If you are migrating your site to a new domain or server, or restoring a back up, you can end up breaking your permalinks.
You can do this if you’re using a plugin or service and you face an unexpected bug/error. Or if you do it manually and make a small mistake.
If you a migrating to a new server and you are getting issues, it is quite likely that your issues have to do with the FTP permissions of your .htaccess file. (If this is you, jump to the changing permissions of your .htaccess file section.)
4. File Permissions Or Other Changes To .htaccess File
Your .htaccess file is basically a file that decides who/what gets to do see/use what files on your site. Lately people might focus on how it can be used to defend against bots and other malicious attacks, but it is also what is used to create permalinks in WordPress.
If the file itself has been changed, or even just the file permissions for the .htaccess file, it can completely break your permalinks.
Sometimes file permissions can change without apparent reason. Maybe your host implemented a site-wide sweep, changing permissions on every file of every client in an attempt to improve overall security.
So if you did not update anything or migrate, or restore a backup, you may want to jump straight to the .htaccess section of this tutorial.
How To Fix Broken Permalinks In WordPress
All you need to fix broken permalinks is access to your WP Dashboard, FTP credentials to access your server, and a little bit of patience.
1. Reset Your Permalink Settings
The first thing you want to do if you’re having this issue, is to simply reset your permalink settings.
This is simply to double check that it’s an actual issue, and not just a small stutter that might have occured during updating or migrating.
Simply log into your WP Dashboard, then go to the permalinks settings. Change your settings away from the standard setting, for example to numeric, then save changes. Now simply select your standard setting again, and save the changes.
Now go back to your site, and try to go to any of your posts and pages. Do they show up as they should, or do they show a “Page Not Found” or 404 error?
If they show up as they should, good news.. your problem was likely a stutter caused by a temporary conflict or minor bug.
If you keep getting the error, you should keep following the steps until the problem is solved.
2. Check And Fix Problems With Your .htaccess File
First off, you need to find your FTP credentials. Usually, you can log into your user with your host and then simply see the ftp user inside the dashboard.
If not, you can head into cPanel and get an overview of your ftp users. Go into your cPanel, and click through to FTP Accounts.
Scroll down and you will see your existing accounts.
If you don’t know the password of any of your existing accounts, and you cannot see it in your cPanel, you can simply create a new FTP user.
Then all you need to do is open an FTP Client (like FileZilla) and connect to your website via ftp using your FTP credentials. (Usually ftp.yourdomain.com)
Now head over to the root folder of your WordPress site, and right click your .htaccess file. You should see the option for “file permissions”.
Your file permissions should look something like this:
If they don’t, set them to 644. Now go back to the permalink settings on your site and try to change the settings and save the changes once more.
Check your page again, still getting an error?
Time to check out the insides of your .htaccess file. Download the file, and open it up.
If you have the W3TC plugin installed, your file should look more or less exactly the same as this:
Even if you don’t, you should at least have the highlighted part in your .htaccess file.
If you don’t, the easiest way to fix this, is to set the file permissions to 666, then reset the permalink settings, and then change your file permissions back to 644.
If you download your .htaccess file again and open it, you should be able to see the highlighted part. If not, you can copy and paste the appropriate code from this codex page.
Try to reset the settings again and visit a post or page. More than likely this will finally fix your website. But if you’re still getting a 404 error, don’t despair.
3. Find And Fix Plugin Conflicts
Another thing that could be causing your permalinks to not work, could be a plugin conflict.
For example a plugin that deals with 403 redirects or some such things.
If you do not have an overwhelming amount of plugins, an easy way to check for and fix this problem, is simply disabling plugins one by one.
First, disable a plugin, then go over to permalink settings and reset the settings again. Now try again to see if your pages show up as they should. No? Disable the next plugin and try again.
One thing to note is that it could be that it is not one plugin that is causing the problem, but more than one plugin with incompatibilities working in tandem finally creating a big problem.
Once you have identified the plugin that seemed to be responsible for stopping you from setting permalinks, you can try to reactivate it. It may not affect your permalinks when they have actually been set, but may need to be deactivated for you to be able to set your permalinks.
Obviously, this is not an ideal way for plugins to interact with your site, but if you are absolutely dependent on this plugin, and there is no good alternative available, it is possible to simply use that as a termporary solution with future updates.
I hope that you found the solution to your permalink/404 page error problem in this tutorial.
If you followed the steps and you’re still facing a problem, please let us know in the comments and we will try our best to assist you with this issue.
WordPress is an amazing piece of software. WordPress allows us to easily create complex websites that would be way way beyond most of our means if all we had was a code editor. The upside is obvious. However the downside of this, is that as WordPress users, might have to deal with complex problems relating to web technologies that we do not understand.
If you routinely run into situations where you feel completely out of your depth, and your website is a crucial part of your business it might be time to get some professional help.
There are now many WordPress support and maintenance services available. You can see an overview and comparison of 8 different services here.
Or if you have the time, interest and dedication, you could always decide to dive deeper into WordPress and the languages/technologies it’s built with.