Bobcares

How to fix WordPress permalinks – Top 5 causes and solutions

by | Oct 23, 2018

WordPress is a great way to build websites.

But as the app is database driven, the default URL structure is a long string of id numbers like: example.com/post.php?id=91824, which is not user-friendly.

To make links look pretty and SEO friendly, WordPress has a built-in feature called Permalinks.

When the URL structure is changed, WordPress updates a file called .htaccess and changes site settings. Usually this works well, but sometimes this fail.

We’ve seen many causes for this error as part of our  Support Services, where we manage tech support desk of web hosts.

Today we’ll go through the top 5 causes we’ve seen and fixes that we apply.

 

Causes and fixes for Permalinks failure

WordPress has Permalinks disabled by default and url will be of the format “example.com/post.php?id=91824with page number in it.

To make the links search engine friendly, website owners often set Permalinks based on the “Name of post”. Then the url format will be “example.com/contactus“.

This works based on a set of rewrite rules added by WordPress in the .htaccess file of the website.

But we’ve seen scenarios where the addition of these rewrite rules fail due to reasons like wrong webserver configuration, high server load etc. And that causes website errors.

 

1. Update Permalinks from WordPress

When a WordPress user updates Permalink from Dashboard, due to server connectivity issues, the setting may not get saved in the website files. This ends up in permalink failure.

The quick and easiest fix here is to re-do the Permalink setting from WordPress Dashboard. Click a new permalink setting, click Save, and then revert back to the custom setting you want and re-save.

Here the wordpress tries to add the rules once again and that fixes the problem.

 

2. Correct .htaccess rules

In Unix servers, a file called “.htaccess” tell the web server on the way how contents of each directory show up on the website. Permalink setting add rules to this .htaccess file.

In VPS servers that we manage, we often see cases where Webserver is not able to write to .htaccess due to bad permissions of the file.

To fix the problem, our Support Engineers corrects ownership and permission of the .htaccess file so that it is readable and writable by the Webserver, Apache. Also we flush and add the basic set of rules instead.

# 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

 

3. Webserver AllowOverride configuration

Permalinks work based on the rules in .htaccess file. And for the webserver to see the rules in .htaccess file, it needs an option AllowOverride enabled in webserver config file.

On servers with ” AllowOverride None” option set, Apache ignores .htaccess rules by default. This causes links to fail.

To fix permalinks, we change the AllowOverride None setting to AllowOverride All and then rebuild Apache. This allows the web server to start reading the .htaccess files and links redirect successfully.

 

4. Enable mod_rewrite in Apache

WordPress uses an Apache module called “mod_rewrite” for the working of Permalinks.

Mod_rewrite allows the rewriting of links and translate it into a different link. Then wordpress serves the content from this new link.

WordPress Permalinks fail on servers with mod_rewrite disabled. Thus it becomes the primary responsibility of our Hosting Support engineers to enable mod_rewrite for Apache webserver.

 

5. WordPress Plugins

WordPress allows the use of additional plugins to extend the functionality of website. But at times, certain plugins interfere with the rewrite rules in .htaccess and cause Permalinks to fail.

In a VPS server that we manage, we recently saw broken Permalinks due to a plugin ‘wp-super-cache’. We isolated the problem by disabling plugins one by one. After disabling the problematic plugin, website links started to work.

 

Conclusion

The fix for wordpress permalinks mainly depend on the rules in the .htaccess file and webserver configuration. Today, we’ve discussed the top reasons that our Support Engineers often see in servers and how we fix them.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.