WordPress permalinks not working?
Unexpectedly running into a 404 error on some of your pages? Itβs a sign of broken permalinks.
Broken permalinks are a common WordPress issue. This particular issue often occurs after installing or updating a plugin, or a theme. Other causes include changes in the .htaccess file, migrating to a new domain or server, restoring backups, etc.
The good news is that broken permalinks can be fixed.
How To Fix Broken Permalinks In WordPress
You can fix broken permalinks in WordPress by resetting the permalink settings, replacing .htaccess file with default code, and sorting all conflicting plugins.
The broken permalink issue, or the β404 error,β is one of the most common issues on a WordPress site. This can be caused by several issues which, in turn, can be fixed via simple steps.
The β404 Page Not Foundβ error is quite common for those who use websites daily. It may be a harmless error for the user, and they may move on. However, it is a huge issue for the owner of a website.
This error means that you are facing an issue of a broken permalink, or a link to another website that is designed to remain unchanged. Before we suggest the steps to fix your broken permalink, you should understand the reasons why this error occurs.
Listed here are a few reasons why your site might be suffering from an issue of a broken WordPress permalink.
Below Steps To Fixing Broken Permalinks In WordPress
- Reset the permalink settings
- Replace .htaccess file with default code
- Sort all conflicting plugins
In most cases, you wonβt need to apply all of these solutions. The key is to find out whatβs causing the problem and apply the best solution for that case.
In this section, weβll show you all these four methods step-by-step, so you can fix your permalinks in no time.
Reasons Why A Permalink Might Be Broken
There are several triggers of broken permalinks.
If you are trying to find the root cause of your broken link, the following reasons could be playing an important role in causing the 404 error:
- A new plugin installation pay cause interruption with your program files
- While restoring your backup files or during migrating WordPress to a different server or domain can result in a broken permalink.
- Once you have updated a plugin, there might be a compatibility issue resulting in a 404 error
- Any changes with your .htaccess file can result in a broken permalink
Investigating these causes my involve looking through your websiteβs directory pages.
1. Reset The Permalink Settings
As obvious as it sounds, most people forget the first thing they need to do is to reset their permalink settings.
Double-checking your permalinks settings helps you save time and energy. If there is a small glitch in the settings, you can quickly get past it andΒ fix your broken link immediately.
Donβt be completely sure that there is no issue with your settings simply because you didnβt do anything recently. A small issue can occur while you were updating your software version or migrating your files.
Changing your permalink settings is quite simple. Follow the steps mentioned below to quickly revert your permalink settings back to the standard ones.
- Login to your WordPress Dashboard.
- Click on βPermalink Settings.β Once you get there, you need to change the settings away from standard settings. For instance, change it back to βnumeric.β
- Once you have done this, you need to select a βstandard-settingβ again and save changes.
- Go back to your WordPress site, and check the post or the site pages.
If the permalink is fixed, you can be thankful that the issue was nothing more than a slight glitch in your settings. However, if the issue persists, then you need to follow the next steps below to find the root cause of the problem and fix it.
2. Reconfigure the .htaccess File
The .htaccess is one of the core files thatΒ run your WordPress website. This file plays a useful role in carrying out several important tasks on your site. You can use it to add and customize several features on your website such as improving security and increasing traffic.
With the .htaccess playing some of the key roles on your website. There is a possibility that if this file is changed or altered in any way, it may lead to the much dreaded β404 error.β
Here are a few steps that can help you sort your .htaccess file and replace it with a default one.Β
# 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]
</IfModule>
# END WordPress
- Select the βFile Managerβ option through the hpanel.
- Once you get there, select the domain you are using and click on βGo to File Manager.β
- You can now select the βpublic_htmlβ folder and select β.htaccess file.β
- Right-click on the file and rename it with a different name.
- Once you have renamed the old file, select the βNew Fileβ icon and name the file β.htaccess.β
- Write the code below in your new .htaccess file and click on save.
The above solution will most likely be able to solve your problem with the .htaccess file.
Once you have followed the steps above, go back toΒ your WordPress siteΒ and see whether the error occurs again.
If the issue is still there, go on to the next step.
3) Solve conflicts with Plugins/Themes
Sometimes a plugin or theme can generate conflicts that may cause the WordPress permalinks to break or stop working. The good news is that finding the faulty plugin/theme isnβt hard. All you need to do is deactivate your plugins and then activate them one by one. Letβs see how to do that.
First, log in to your WordPress dashboard and go toΒ Plugins. Then, you need toΒ deactivate all your installed plugins. For thatΒ select them, selectΒ DeactivateΒ from the dropdown and clickΒ Apply.
Now all your plugins will be deactivated.
After that, go to your site and check whether the permalinks are working. If you donβt see any errors, it means that one (or more) plugins were causing the issue. So now activate the plugins one by one and check your permalinks until you find the one thatβs generating problems.
Once you find the faulty plugin, contact their support team and ask them for help.
If youβve tried all the solutions above but your WordPress permalinks are still not working, the Apache server might be the issue.
4) Verify the Apache configuration
Sometimes Apache web servers can have issues with permalinks. Apache comes with a security module called Mod_security. If you have enabled it on your site, permalinks might be broken. All you need to do to solve it is disable it from your cPanel.
If you are unsure about this extension, you can ask your web hosting support team to disable it.
Once the Mod_security module is disabled, save the permalinks again and the error will be gone.
This is how you can fix the issues with the permalinks on an Apache server.
NOTE: Most times these solutions will fix the problem but if they donβt, you may need to try something else. Sometimes people overlook the Apache override permission. If thatβs not set, the .htaccess wonβt be invoked, so the changes in the permalinks wonβt have any effect. To fix that, you should set a directive for the directory your site is being served from.
Sometimes this wonβt be possible, but if you have control over the configuration of the HTTPD server, try the following code inΒ httpd.confΒ orΒ apache2.conf:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Once that is set, restart the service, and your permalink should work again.
NOTE: Sometimes the above solution may not work because the directive mod_rewirte is missing. There are two ways to allow the mod_write module:
- Type sudo a2enmod rewrite in the terminal to trigger the mod_write module and then restart Apache to apply the changes by typing sudo systemctl restart apache2 in the terminal.
- If youβre using another service, simply enable rewrite_module in Apache and then remember to restart the service or VPS.