In WordPress you will see a lot of errors. Though it is a very powerful cms. The biggest frustrating thing is getting 404 errors when you already have those Page or Post in your WordPress website.
Generally with this error an user can access their WordPress admin area, their blog’s main page, but when accessing a single posts they get a 404 Not found error.
Things like the white screen of death when you upload images, update themes or plugins which can also happen.
Today we will show you how to fix 404 errors in wordpress.
Why this 404 error occurs when you already have that page or post in your WordPress
It is the output of conflict in [highlight2]mod_rewrite[/highlight2] in Apache. If it is not enabled or if it is not configured properly it cannot rewrite your URL to use your selected permalinks.
How to fix WordPress posts or page returning 404 error
There is actually two possible solution. Those are:
- Resetting your Permalinks
- Resetting your .htaccess
Resetting your Permalinks
A permalink is a permanent URL for your posts, categories, files and other comparative pages. It’s the one of a kind connection that coordinates to a particular, comparing post.
When you install WordPress, It automatically setup a default permalink for you, however, you can choose the permalink types by your own in wordpress later on.
If in any means Apache extension [highlight2]mod_rewrite[/highlight2] disabled or there is conflicting between apache extension with your theme or plugin then your links stops working.
So resetting permalinks will works in most scenario. To do that please follow these steps:
- Go to Settings » Permalinks
- Select Plain and click Save Changes.
- After saving then select your previous permalink that you had and click Save changes.
It will reset your permalink settings and you should able to see your posts without having 404 error.
If this doesn’t fix then please continue to the article:
Resetting your .htaccess
To reset your .htaccess login in your cpanel or FTP. Then:
- Rename your .htaccess file to .htaccess_old
- Create a new .htaccess file.
- For single installations of WordPress paste these lines of codes:
# 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
- For subdirectory installations of WordPress Multisite, use the code below:
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L]
- If install WordPress in subdomain, use this instead:
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^wp-admin$ wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^(wp-(content|admin|includes).*) $1 [L] RewriteRule ^(.*\.php)$ $1 [L] RewriteRule . index.php [L]
Once you saved the files the rewrite rules will be flushed and you should see your posts.
Fixing Custom Post Types
If you are having the errors in your custom post types. Then you need to check custom post types unique slug and title.
If two or more posts contains same title or slug, then you should change those. Because only one post can have that title and slug so be sure to change the others to something unique.
Further Troubleshooting
If it stills appear the error then you can change the .htaccess file permission to 600 or 777.
If you think it is causing for your theme then simply activate a pre packaged theme like twenty sixteen. Then check a single post if it is fixed.
If you think it is causing for your plugin then deactivate all plugin and check. Then activate one by one which one is the main culprit for this 404 error.
Get Help From an Expert:
There is a lot of wordpress expert available if the steps don’t changes the scenario of the error.
You can get a help of hand for resolving the issue by our super 24 / 7 support team. Our expert team replies immediately for any kind of wordpress errors. To do that simply go to our Request a quote page and submit.