Digital Jacky

How to Fix WordPress Permalink / URL Errors

The “Permalinks” functionality of WordPress enables Apache’s “mod_rewrite” function to generate search-engine and human-friendly URLs, rather than using the standard “query string” approach to URLs. In some cases, clients have reported seeing wrong content of another page being displayed on rewritten URLs and not displaying the correct article/post while Permalink is enabled. This can be easily fixed by modifying the default WordPress code in your .htaccess file that is located inside your “public_html” folder.

The default code at .htacess file will look something similar to this:

# 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

Just modify the above-highlighted line number 8, see below:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php/$1 [PT,L]
</IfModule>
# END WordPress

 

Some clients have reported using this coding variant with success:

RewriteRule ^(.*)$ /index.php/$1 [L]

Modifying this line in your .htaccess file will fix errors on rewritten URLs in WordPress. As you can see, all these are coding related issues and not server related problems. So if you use another application other than WordPress, please try to modify your online application’s RewriteRule along these lines inside the .htaccess file. For any assistance beyond this sample rewrite rule, you will need to hire a PHP programmer.

Leave a Comment

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