How to fix WordPress posts returning a 404 error

If you click a WordPress post or page and receive a 404 Not Found error, the most likely cause is a problem with your Permalink settings. Permalinks define the structure of your WordPress URLs and a mismatch will cause posts and pages to become inaccessible.

Your content is still safely held in your database, but you’ll need to change some settings to restore access to the data.

As a first step, in the WordPress Admin dashboard, head to Settings > Permalinks and click the Save Changes button to refresh the permalinks settings and flush the rewrite rules in your .htaccess file.

Save Permalinks

.htaccess is a configuration file used by the Apache web server that, among other features, can control access to the resources on your server. In most cases, this step will resolve WordPress 404 errors, but if it does not, proceed to the next step.

Edit your .htaccess file manually

Log in to your HostPapa Dashboard and in the top navigation menu, select My cPanel.

My cPanel Menu

Now select File Manager.

cPanel

At the top right of the screen, click the Settings button.

cPanel File Manager Settings

.htaccess files are hidden from view by default. To expose them, ensure Show Hidden Files (dotfiles) is checked in the Preferences panel, then click Save.

Show Hidden Files option

Navigate to your WordPress root folder using the left sidebar. Right-click on the .htaccess file and select Edit.

Add the following code to the .htaccess file:

# 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

.htaccess edit

If your .htaccess file is locked, right click on the file once again and select Change Permissions. Make the file available for writing by changing the permissions to 644. Then try to refresh your Permalinks again in the WordPress dashboard, using the steps above.

For more help, or to ask a question, please open a support ticket from your HostPapa Dashboard. Follow this link to learn how.

Related Articles

Get online with our affordable web hosting

Get online with our affordable web hosting

Learn more now
HostPapa Mustache