How do i fix php page not found?

How do i fix php page not found?

WordPress ‘404 not found error’ indicates that a requested page or post cannot be found on your website. This error can occur unexpectedly, or in some cases, after you make changes to your WordPress site.

Thankfully, fixing this error is very easy and requires no technical experience. In this guide, we will take you through the steps for fixing posts returning 404 error in WordPress.

WordPress is a flexible platform – no doubt. But, its flexibility can be a double-edged sword. Sometimes, you just do too much, overtaking some settings and the whole hell breaks loose, random errors start appearing, and your site goes down.

Luckily, because WordPress has so many users, finding help is not hard. We have done a series of articles covering the most common WordPress errors, explaining to you how to fix them.

For example, we have done an article on How to fix briefly unavailable for scheduled maintenance, How to fix WP syntax error, or Maximum Execution Time Exceeded errors.

You can also check our WordPress support forums to learn how to ask for WP Help.

Of course, if you are unable to fix issues yourself, you can always contact FixRunner, and get your site back to full speed ASAP.

Content:

  1. What does 404 error mean and what causes it?
  2. How to Fix WordPress Posts Returning 404 Error
    • Save Permalinks
    • Manually reset permalinks:
      • When your site is in the main domain
      • If your site is in a subdomain
      • When your site is in a subdirectory

What does 404 error mean and what causes it?

When a 404 error message pops up, it simply means the server can’t find the file the user requests.

For instance, If you try accessing a specific URL (say domain.com/what-is-WordPress), if no content carries that name, you’ll get a 404 error message.

This error has absolutely nothing to do with your server, it just means the requested file (image, page, or post) is missing.

The error message may differ slightly based on the browser you use.

Google Chrome reads “404. That’s an error.” “The requested URL /~ was not found on this server. That’s all we know”

How do i fix php page not found?

Other variations include:

  • “The page cannot be found”
  • “We can’t find the page you’re looking for.”
  • “The requested URL was not found on this server.”
  • “Not Found”
  • “HTTP Error 404”
  • “Error 404”
  • “404 Not Found”

Also, you can set up your own unique 404 error page using a WordPress plugin. While this isn’t crucial, it helps you explain better to your audience, letting them know what next to do.

How do i fix php page not found?

Note that this error is not unique to WordPress alone. It can happen on any website.

How to Fix WordPress Posts Returning 404 Error

Since this ‘404 not found error’ indicates a problem with your links, you can usually fix it by ensuring your permalinks are correctly configured and saved. You may also need to reset your linking structure using your .htaccess file.

Very often, the solution to 404 error in WordPress is simply saving your permalinks. Doing this will update your .htaccess file with the correct configurations for your WordPress website.

To save permalinks, login to your WordPress dashboard and go to Settings > Permalinks.

How do i fix php page not found?

Next, scroll to the bottom and simply click Save Changes.

How do i fix php page not found?

Now try accessing your posts to see if the issue is resolved.

If saving the permalinks does not solve your WordPress error 404 issue, you can manually reset it by editing your .htaccess file.

To do this, access your website files using FTP. When connected via FTP, locate your .htaccess file and edit it.

How do i fix php page not found?

Add in one of the following codes, save, and upload the updated file to your server:

A) Reset permalinks when your site is in the main domain

If your site is on the main domain, e.g. www.yoursite.com, add this code to your .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

After editing and uploading the file, refresh your site and access posts and pages to see if this fixes your WordPress error 404 issue.

B) Reset permalinks if your site is in a subdomain and fix WordPress 404 Error

If your site is installed in a subdomain, such as blog.yoursite.com, use this code instead.


RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
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]

C) Reset permalinks when your site is in a subdirectory

If your site is on a subdirectory, such as www.yoursite.com/blog, edit .htaccess to include this code instead.


RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
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]

How to Monitor 404 error on your website

We may not be able to prevent WordPress error 404 from occurring but we can monitor and minimize it using the following.

Google Search Console

You can view a list of 404 errors that google has encountered on your site. To do this, sign up for an account, verify your website. Next, go to Crawl Errors >> Not found.

Google Analytics

This tool tracks and reports 404 error. To do this, sign up with Google Analytics and start tracking.

WordPress Plugin

If you prefer a WP plugin, the Redirection plugin can help you track 404 errors from your WP dashboard.

Ahrefs (or any Third-Party Audit Tool)

Tool like Ahrefs are effective in monitoring 404 errors on your WP site.

How Can You Use This Information?

Fixing ‘404 not found error’ usually involves ensuring your WordPress permalink structure is correctly configured in your .htaccess file.

The steps covered in this guide have shown you how to do this from within the WP dashboard, as well as by manually editing .htaccess. In some cases, the solution may be more complex. For example, you may need to enable mod_rewrite if it is disabled. If you have gone through the steps and still have WordPress error 404 issue, please tell us about it in the comments. We will provide a quick fix.

Alternatively, you can request our WP Support service and one of our developers will get to work immediately to fix your site.

For more step by step WordPress tutorials check our WordPress blog.

Read More Useful Articles: