https://panelsecure.com/kb/60/

Fixing 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 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 last highlighted line in RED to GREEN, 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 code variant with success:
RewriteRule ^(.*)$ /index.php/$1 [L]

Also make sure to make the .htaccess file permissions to “read-only”. This is done to prevent WordPress from modifying the .htaccess file whenever permalinks are invoked. This can be accomplished by modifying the .htaccess file permission to “004”.

To make this change go to "File Manager" in cPanel, on the top bar "Settings" button you need to enable "Show Hidden Files". Then go to "public_html" folder and right click on the file .htaccess, there go to "Change Permissions".
 


Please Note
: After making the necessary changes in your .htaccess file, make sure to clear your browser cache by pressing "Ctrl + F5" on your keyboard and refresh your web page to see the result. In some cases you need to clear your entire browser cache by pressing "Ctrl + Shift + Del".

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. PanelSecure's Support Team will not help you in coding related matters!
 .

  • 1041 Users Found This Useful
Was this answer helpful?

Related Articles

Unable to send email from server using PHP mail() function

After the recent update of cPanel v64, all outgoing emails sent through PHP scripts will need to...

Unable to access the login page of WHM or cPanel or WebMail

If you cannot see the login page of WHM / cPanel / WebMail, then probably your LOCAL Internet...

Disable Apache mod_cache for Dynamic Web Contents

Most web sites have large amounts of content that remains unchanged or is rarely modified after...

Powered by WHMCompleteSolution