Вордпресс ошибка 404

Languages: English • Creating an Error 404 Page 日本語 (Add your language)

Languages:
English
Creating an Error 404 Page 日本語
(Add your language)

While you work hard to make sure that every link actually goes to a specific web page on your site, there is always a chance that a link clicked will slam dunk and become a famous 404 ERROR PAGE NOT FOUND.

All is not lost. If your visitors encounter an error, why not be a helpful WordPress site administrator and present them with a message more useful than «NOT FOUND».

This lesson will teach you how to edit your «error» and «page not found» messages so they are more helpful to your visitors. We’ll also show how to ensure your web server displays your helpful custom messages. Finally, we’ll go over how to create a custom error page consistent with your Theme’s style.

Contents

  • 1 An Ounce of Prevention
  • 2 Understanding Web Error Handling
  • 3 Editing an Error 404 Page
  • 4 Creating an Error 404 Page
  • 5 Tips for Error Pages
    • 5.1 Writing Friendly Messages
    • 5.2 Add Useful Links
  • 6 Testing 404 Error Messages
  • 7 Help Your Server Find the 404 Page
  • 8 Questions About Error Files

An Ounce of Prevention

Some errors are avoidable, you should regularly check and double check all your links. Also, if you are deleting a popular but out-of-date post, consider deleting the body of the post, and replacing it with a link referring visitors to the new page.

Understanding Web Error Handling

Visitors encounter errors at even the best websites. As site administrator, you may delete out-of-date posts, but another website may have a link to your inside page for that post.

When a user clicks on a link to a missing page, the web server will send the user an error message such as 404 Not Found. Unless your webmaster has already written custom error messages, the standard message will be in plain text and that leaves the users feeling a bit lost.

Most users are quite capable of hitting the back key, but then you’ve lost a visitor who may not care to waste their time hunting for the information. So as not to lose that visitor, at the very least, you’ll want your custom message to provide a link to your home page.

The friendly way to handle errors is to acknowledge the error and help them find their way. This involves creating a custom Error Page or editing the one that came with your WordPress Theme.

Editing an Error 404 Page

Every theme that is shipped with WordPress has a 404.php file, but not all Themes have their own custom 404 error template file. If they do, it will be named 404.php. WordPress will automatically use that page if a Page Not Found error occurs.

The normal 404.php page shipped with your Theme will work, but does it say what you want it to say, and does it offer the kind of help you want it to offer? If the answer is no, you will want to customize the message in the template file.

To edit your Theme’s 404 error template file, open it in your favorite text editor and edit the message text to say what you want it to say. Then save your changes and upload it to the theme directory of your WordPress install.

While you are examining and editing your 404 template file, take a look at the simple structure of the 404.php file that is shipped with Twenty Thirteen. It basically features tags that display the header, sidebar, and footer, and also an area for your message:

<?php
/**
 * The template for displaying 404 pages (Not Found)
 *
 * @package WordPress
 * @subpackage Twenty_Thirteen
 * @since Twenty Thirteen 1.0
 */

get_header(); ?>

	<div id="primary" class="content-area">
		<div id="content" class="site-content" role="main">

			<header class="page-header">
				<h1 class="page-title"><?php _e( 'Not Found', 'twentythirteen' ); ?></h1>
			</header>

			<div class="page-wrapper">
				<div class="page-content">
					<h2><?php _e( 'This is somewhat embarrassing, isn’t it?', 'twentythirteen' ); ?></h2>
					<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'twentythirteen' ); ?></p>

					<?php get_search_form(); ?>
				</div><!-- .page-content -->
			</div><!-- .page-wrapper -->

		</div><!-- #content -->
	</div><!-- #primary -->

<?php get_footer(); ?>

So, to change the error message your visitor sees, revise the text within the h1 heading and within the page-content class; if necessary, add more paragraphs below that.

Creating an Error 404 Page

If your WordPress Theme does not include a template file named 404.php, you can create your own.

Because every theme is different, there is no guarantee that copying over the 404.php template file found in the Twenty Thirteen Theme will work, but it’s a good place to start. The error page you copy from the Twenty Thirteen Theme will adopt the style of the current theme because it actually calls the header and footer of the current theme. That’s less work for you, and you may only have to edit the message to suit your particular needs.

To use the 404.php template file from the WordPress Twenty Thirteen Theme:

  1. Copy the file /wp-content/themes/twentythirteen/404.php into the directory of your current theme.
  2. Then, as described in the previous section, edit the error message to present your desired error message.

If copying the default 404.php into your theme directory does not work well with your theme, you can also:

  • Change the Default Theme’s 404.php template file’s header, sidebar, footer, and other codes to match the rest of the Theme’s layout.

Or

  • Copy the index.php file of your current theme to a file called 404.php.
  • Open that file and delete all sections dealing with posts or comments, see The Loop.
  • Then, edit your 404 error message.

Tips for Error Pages

There are various improvements you can make to your 404 Error web pages so let’s look at some of your options.

Writing Friendly Messages

When an error message is displayed, you can say many things to help a visitor feel reassured they’ve only encountered a minor glitch, and you’re doing the best you can to help them find the information they want. You can say something clever like:

"Oops, I screwed up and you discovered my fatal flaw. 
Well, we're not all perfect, but we try.  Can you try this
again or maybe visit our <a 
title="Our Site" href="http://example.com/index.php">Home 
Page</a> to start fresh.  We'll do better next time."

You should also attempt to show the user what they want. Check out the AskApache Google 404 Plugin to add google search results to your 404.php

Or, say something shorter and sweeter. Almost anything you say is better than 404 Error Page Not Found. You can find more information about writing 404 Error pages on the Internet, like List Apart’s Perfect 404.

As an implementation of the Perfect 404 page, this solution will tell the user it’s not their fault and email the site admin.
Helpful 404 page

When a visitor gets a 404 error page, it can be intimidating, and unhelpful. Using WordPress, you can take the edge off a 404 and make it helpful to users, and yourself, too, by emailing whenever the user clicks a link to a non-existent page.

<p>You 
<?php
#some variables for the script to use
#if you have some reason to change these, do.  but wordpress can handle it
$adminemail = get_option('admin_email'); #the administrator email address, according to wordpress
$website = get_bloginfo('url'); #gets your blog's url from wordpress
$websitename = get_bloginfo('name'); #sets the blog's name, according to wordpress

  if (!isset($_SERVER['HTTP_REFERER'])) {
    #politely blames the user for all the problems they caused
        echo "tried going to "; #starts assembling an output paragraph
	$casemessage = "All is not lost!";
  } elseif (isset($_SERVER['HTTP_REFERER'])) {
    #this will help the user find what they want, and email me of a bad link
	echo "clicked a link to"; #now the message says You clicked a link to...
        #setup a message to be sent to me
	$failuremess = "A user tried to go to $website"
        .$_SERVER['REQUEST_URI']." and received a 404 (page not found) error. ";
	$failuremess .= "It wasn't their fault, so try fixing it.  
        They came from ".$_SERVER['HTTP_REFERER'];
	mail($adminemail, "Bad Link To ".$_SERVER['REQUEST_URI'],
        $failuremess, "From: $websitename <noreply@$website>"); #email you about problem
	$casemessage = "An administrator has been emailed 
        about this problem, too.";#set a friendly message
  }
  echo " ".$website.$_SERVER['REQUEST_URI']; ?> 
and it doesn't exist. <?php echo $casemessage; ?>  You can click back 
and try again or search for what you're looking for:
  <?php include(TEMPLATEPATH . "/searchform.php"); ?>
</p>

Add Useful Links

If you encounter a «page not found» situation on the WordPress site, it is filled with helpful links to direct you to the various categories and areas of information within the WordPress site. Check it out at http://wordpress.org/brokenlink.php.

To add similar useful links to your 404 page, create a list, or a paragraph, so the visitor can easily determine which section might be useful to visit. Information of that nature is much better than having the user just reach a dead-end. To help you understand how to link to documents within your site, especially to Pages and Categories, see Linking_Posts_Pages_and_Categories.

Testing 404 Error Messages

To test your custom 404 page and message, just type a URL address into your browser for your website that doesn’t exist. Make one up or use something like:

http://example.com/fred.php

This is sure to result in an error unless you actually have a php file called fred. If your error page doesn’t look «right», you can go back and edit it so it works correctly and matches your Theme’s look and feel.

Help Your Server Find the 404 Page

By default, if WordPress cannot find a particular page it will look for the 404.php web page. However, there may be cases where the web server encounters a problem before WordPress is aware of it. In that case, you can still guarantee that your web server sends the visitor to your 404.php template file by configuring your web server for custom 404 error handling.

To tell your web server to use your custom error files, you’ll need to edit the .htaccess file in the main directory (where main index.php file resides) of your WordPress installation. If you don’t have an .htaccess file, see Editing Rewrite Rules (.htaccess) on how to create an .htaccess file.

To ensure the server finds your 404 page, add the following line to your .htaccess file:

ErrorDocument 404 /index.php?error=404

The url /index.php is root-relative, which means that the forward slash begins with the root folder of your site. If WordPress is in a subfolder or subdirectory of your site’s root folder named ‘wordpress’, the line you add to your .htaccess file might be:

ErrorDocument 404 /wordpress/index.php?error=404

Questions About Error Files

Why not just hard code the path all the way to the 404.php file?
By allowing index.php to call the error file, you ensure that the 404.php file used will change automatically as you change your theme.
What happens if I switch to a theme that does not have a 404.php file?
Visitors clicking on a broken link will just see a copy of the home page of your WordPress site (index.php), but the URL they see will be the URL of the broken link. That can confuse them, especially since there is no acknowledgement of the error. But this is still better than a getting a «NOT FOUND» message without any links or information that could help them find what they seek.

You’ve likely seen the “Page Not Found” error before. Unfortunately, if you operate a website of any sort (WordPress or not), the day will probably come when you see the message on one of your own pages.

Fortunately, like many common WordPress errors, 404s are relatively easy to troubleshoot and fix. The solution usually involves restoring your site’s permalink structure — something you can do in just a few minutes.

In this article, we’ll explain just what a 404 error is and what can cause one on your site. Then we’ll walk you through how to fix it in four simple steps. Let’s get started!

An Overview of the WordPress 404 Error

A 404 error, also known as a “Page Not Found” error, indicates that your browser can’t locate the page you’re trying to access. The exact message can look a bit different depending on the browser you’re using, but it will generally always contain either the “404” code or a “page not found” message of some kind.

DreamHost Glossary

404 Error

A 404 error is an HTTP status code that indicates that the page a user is trying to access does not exist. 404 errors can occur for a wide variety of reasons, but they almost always lead to a poor User Experience (UX).

Read More

Websites can also create their own custom 404 pages.

A custom 404 error page.

Seeing this notification (or any other error message) when you’re trying to access your site can be frustrating. While there is a chance that your post has actually gone missing, the vast majority of the time, there’s a more benign cause.

Some common reasons that WordPress posts might return 404 errors include:

  • A mistyped URL. It could simply be attributed to a typo in the URL. This is the most common cause.
  • An issue with your Domain Name System (DNS) settings. If you’ve recently updated any of your DNS information and you’re seeing this error, it could be because the changes haven’t propagated fully. It can take up to 48 hours for this process to complete.
  • Problems with the permalink structure of your site. Permalink problems can be caused by a missing, broken, or corrupted .htaccess file. Compatibility issues with WordPress components such as plugins and themes could also be the culprit.

Regardless of the cause, this error prevents access to your site, so it needs to be resolved as quickly as possible. We’ll look at troubleshooting and resolving the problem shortly.

Skip the Stress

Avoid troubleshooting when you sign up for DreamPress. Our friendly WordPress experts are available 24/7 to help solve website problems — big or small.

Why 404 Errors Matter

404 errors pose several problems for a website, beyond simply preventing you from accessing pages. First, they create a poor User Experience (UX).

If there are many of these errors on your site, and they aren’t resolved quickly, they could eventually turn users away. In the worst-case scenario, those visitors could land on a competing website instead, costing you business.

404 errors can also hurt your Search Engine Optimization (SEO). Search engine crawlers won’t index a page that returns a 404 because they think it doesn’t exist.

What to Do Before Troubleshooting the WordPress 404 Error

Before changing your permalink settings or .htaccess file, it’s a smart idea to create a backup of your website and database. This way, if you accidentally make something worse, you can easily restore your site to a functioning state.

If your website is hosted with DreamPress, backups couldn’t be easier. DreamPress automatically backs up your entire site every day, so you always have a fresh copy to access. You can also create a manual backup with just a few clicks.

How to Fix WordPress Posts Returning 404 Error (In 4 Steps)

With a fresh backup of your site in hand, it’s time to get to work. You’ll want to follow these steps in order and check if the error has been resolved after each one.

Step 1: Reset Your WordPress Permalinks

The first step to try is resetting your permalinks. Head to your WordPress dashboard and navigate to Settings > Permalinks.

The WordPress Permalink Settings page.

From here, just click on Save Changes. That’s right — you don’t actually need to edit anything. Clicking that button will update the permalink settings even if you don’t make any changes. This is important because it also refreshes the rewrite rules used for “pretty permalinks.”

With this done, go ahead and reload the pages you were trying to access. If everything works, you’re all done. If you still get a 404 error, head to the next step.

Step 2: Restore Your .htaccess File

If resetting your permalinks didn’t work, the next strategy is restoring your .htaccess file. This controls how WordPress interacts with the server and how it generates permalinks for your pages. Restoring it to the default settings can fix sudden 404 errors.

To restore the .htaccess file, you’ll first need a way to access it. If you’re using DreamPress hosting, you can use the built-in file manager found in the DreamHost control panel. Most other web hosts offer a similar feature, or you can use a Secure File Transfer Protocol (SFTP) client such as FileZilla. We have detailed instructions for connecting via SFTP if you need help.

For this example, we’ll use the DreamHost file manager. Head to your DreamHost panel and navigate to WordPress > Managed WordPress in the sidebar.

The DreamPress domain settings page.

Find the domain you’re having trouble with and click on the blue Manage button. On the next page, make sure the Details tab is selected at the top, and then click on Manage Files.

The DreamHost file manager.

This will open the file manager in a new tab. Locate and click on the folder that corresponds to your domain name. You’ll find the .htaccess file in this directory (it’s the same one that contains items such as wp-content).

The location of the .htaccess file in the WordPress root folder.

Next, click on the file name and select Edit from the list of options. You can copy the current contents of the file and paste them somewhere for safekeeping. For now, you’ll want to replace the contents with the following:

# 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

This is the default .htaccess file for WordPress. When you’ve pasted this in, go ahead and save the file.

Restoring this file will also reset the permalink settings for your WordPress site. Therefore, if you’re using a custom permalink structure (or have changed it at all from the default), you’ll need to restore that setting too.

To do so, head back to your WordPress dashboard and navigate to Settings > Permalinks (just like Step 1 above). You can change it to whatever you were using before and then save it.

Finally, refresh your website and attempt to load the pages that were returning 404 errors. If everything works now, congratulations! If not, proceed to the next step.

Step 3: Disable All of Your WordPress Plugins and Theme

If you’ve reset your permalinks and .htaccess file, but you’re still seeing 404 errors on your site, the next step is to check your plugins and theme. Plugins, in particular, can sometimes have bugs or compatibility issues that prevent a site from loading.

Let’s start there. The basic idea is to disable them one by one and then check your website. If the error persists, turn it back on and move to the next one.

To get started, head to your WordPress dashboard and navigate to Plugins > Installed Plugins.

The ‘deactivate’ button on the WordPress plugin settings page.

Locate and click on the Deactivate button below the first plugin. You can see that active plugins are shaded blue, while those that are off are white (as you can see with Akismet in the screenshot above). Now, refresh your site and see if the 404 error is still occurring.

If you get the error message, head back to the plugins screen, re-activate the plugin you just tried, and move to the next one in the list. If you find one that resolves the issue, you can check for updates that may resolve the problem or find an alternative with similar functionality.

If none of the plugins prove to be the issue, it’s time to try changing your theme. Head to Appearance > Themes.

The WordPress theme manager.

Your currently-active theme is marked as such. Hover over one of the others and click on Activate. Then refresh your site and try to access the problematic page again.

Note that changing your theme can alter your site significantly. So if you find that your theme is the issue, you may need to spend some time finding one that provides a similar look and features.

Step 4: Set Up a 301 Redirect for Moved or Renamed Content

This one is a bit of a bonus step. If you do actually have content that’s been moved or renamed and thus doesn’t exist anymore at the URL you were using previously, you’ll want to set up some 301 redirects to point that old URL to the new one.

The easiest way to do this is with a WordPress plugin such as Redirection.

The Redirection WordPress plugin for managing 30 redirects.

This tool will enable you to quickly set up the redirects you need. Plus, it’s free and user-friendly.

How to Create Your Own “Error 404 Not Found” Page

If you want to set up your own custom 404 error page, you can do so relatively easily. The process involves adding one line to the .htaccess file to point the error to a specific page and then creating that page. We have full instructions for setting up a custom error page to walk you through the process.

Get Content Delivered Straight to Your Inbox

Subscribe to our blog and receive great content just like this delivered straight to your inbox.

Tools to Help You Monitor 404 Errors Moving Forward

Finally, if you want to keep an eye out for 404 errors in the future, you can use a few handy tools. The Google Search Console will show you crawl errors that the Google bots have come across as they index your site. This is a simple way to see all the issues Google is encountering.

You can also enter your URL into a specialized tool such as the Broken Link Checker, which will scan your entire site for broken links and let you know if it finds a 404 page.

The Broken Link Checker tool for finding 404 errors on your website.

It’s free and easy to use. You can simply input your domain and then click on Check Site.

More WordPress Error Tutorials

Want to learn how to fix other common WordPress errors? We’ve created a series of guides to help!

  • How to Fix the 500 Internal Server Error in WordPress
  • How to Fix Syntax Errors in WordPress
  • How to Fix the WordPress Not Sending Email Issue
  • How to Fix the Error Establishing Database Connection in WordPress
  • How to Fix the Sidebar Below Content Error in WordPress (In 3 Steps)

Ready to Find That Missing WordPress Post?

A 404 error can be frustrating — especially when it happens on your own site. These messages cause problems with SEO and ruin your site’s UX. Fortunately, they’re not too difficult to resolve.

Fixing 404 pages generally involves restoring your site’s permalink structure and setting up redirects for any posts that are actually gone. You can then use tools such as Google Search Console to monitor your site for future 404s.

If you want to spend less time dealing with errors, consider switching to DreamPress, our managed WordPress hosting service. We’ll take care of all the troubleshooting for you, so you can focus on what matters!

Updated on February 2, 2023

How to fix WordPress error 404 page not found

WordPress 404 Error Page Not Found

Table of Contents [TOC]

  • WordPress 404 Error Page Not Found
    • ⭐ What is the Error 404 Not Found?
    • ⭐ What Causes A WordPress 404 Error?
    • ⭐ Error 404 Not Found Variations
    • ⭐ Negative Impact Of 404 Errors
      • Do 404s Hurt SEO and Rankings of a Website?
    • ⭐ How to Fix Error 404 Page Not Found in WordPress?
    • WordPress 404 Error – Internet Explorer Cannot Display The Webpage
    • “The requested URL was not found on this server
    • Fix WordPress 404 Not Found Error on Local Server
    • How to Create Your Own Error 404 Not Found Page
    • Tools to Check/Monitor 404 Errors WordPress?
    • Like this:
    • Related

Introduction –

Are you getting WordPress 404 Page Not Found Error and “WordPress Site Permalinks Not Working” Error?

The WordPress 404 error occurs when the server cannot find the requested file or page, and the user is directed to a “404 Not Found” error message. It commonly happens when a site is newly migrated to a new host, the permalink structure is changed, there are incorrect file permissions, an incorrect URL is opened, or there is a poorly coded plugin/theme.

To fix the 404 error on WordPress, there are various troubleshooting meathods. These include clearing browser history and cookies, setting up the permalink, restoring the .htaccess file, setting up a 301 redirect, disabling plugins/theme, checking the URL, updating the .php file, and contacting the hosting provider.

Lets talk aboiut these in a detailed way, but before that lets go over the basics for a better understanding.


There can be multiple case scenarios like:

  • Is your WordPress showing 404 page not found error?
  • Showing 404 error after publishing or changing permalinks?
  • WordPress page is not found but it exists?

404 not found error in WordPress depicts that the server fails to locate the requested posts or pages in your site. Such errors may arise unpredictably or can occur after certain adjustments or improvements that are made to the WordPress site. Those improvements can be a theme change, changed permalinks, missing file or directory in WordPress etc.

In this article, you will learn about how to solve the 404 page not found error on your wordpress site and make website content accessible to you. Simply follow the steps mentioned below 🙂

These error messages can arise from many reasons. Often, a WordPress page returning 404 error occur due to the management of the site such as the deletion of a page or an article without any redirection.

The probability of such issues is maximum during the migration or redesign of the website.

This can also happen during the migration or redesigning of a site. In this case, the URLs may have changed or been rewritten and have not been correctly redirected to the new URLs.

Like the 500 internal server error or error establishing database connection. WordPress showing a Error 404 Not Found is another common problem that most WordPress users face at some point.

Other Common WordPress errors

  • WordPress White Screen of Death (WSOD) Error
  • 503 Service Unavailable Error WordPress
  • WordPress HTTP Image Upload Error
  • WordPress File And Folder Permissions Error
  • Pluggable.php File Errors in WordPress
  • Upload: Failed to Write File to Disk” WordPress Error
  • Parse Error: Syntax Error Unexpected in WordPress

Are you encountering frequent website issues?

Our WordPress experts can help you Fix WordPress errors?👍


⭐ What is the Error 404 Not Found?

Who has never faced this problem? You do a search on the Internet from your favorite search engine, Google, Bing, and trust it as to the site on which you will land; or else click on a link from a site you are currently looking at hoping to continue reading or benefit from a product or service and there it is, drama!

The browser displays one of the messages that we saw above or another of the same style: Error 404 page not found or 404 Page Not Found.

⭐ What Causes A WordPress 404 Error?

Some common causes of 404 errors.

  • A mistyped URL.
  • Caching problems.
  • An issue with your Domain Name Server (DNS) settings.
  • WordPress compatibility issues.

If you happen to get this error on the entire site’s content, it is generally because of a problem in WordPress site’s permalinks. Whereas, if you find it on some specific pages, it is most often a result of changing some part of the content’s slug without fixing a redirect.

When this is the case for a page on a website (or any document), it means that the content accessible at the Web address URL you have just accessed does not exist or no longer exists. The difference between the two can sometimes help a user find the right URL if they use common sense.

Let’s take an example, to show that if the message corresponds to content that does not exist – if you really want to access the content – sometimes get there all the same. A few days ago, I was browsing a website that linked to another one (or rather thought it was).

Unfortunately, this link (which would have been much appreciated for the site that received it) started in the following way: http : // www  . In this case (this is not always true) the webmaster was most likely well-intentioned, except that he went too fast.

Result of the webmaster’s mistake, when clicking on the link, the site was obviously inaccessible. Frustrating for the user (in this case here, me) and the webmaster of the site who would have received the link if the latter had been inserted correctly.

As a webmaster, you went too fast in making internal link and in a case like this, you need to correct the link as soon as possible because it may risk losing a very large majority of visitors (and sales who go with it) who are not necessarily going to bother doing what we just mentioned or trying to access your product page (or blog article or other) by another means.

The consequences can be very unfortunate for both the traffic on the site and for the turnover of an online store, you must be vigilant and watch this closely to correct the error 404 as soon as it occurs.

To be able to monitor all this, the Google Search Console will be ideal, and to save time in corrective actions, we strongly advise you to use 404 broken link finder tools mentioned below in this article.

⭐ Error 404 Not Found Variations

Because each web browser displays error messages differently, you might see a different message for this error. Other common variations include:

  • Error 404
  • 404 Not Found
  • HTTP Error 404
  • 404 – file or directory not found. wordpress
  • ERROR 404. PAGE NOT FOUND On WordPress site
  • The requested URL was not found on this server.
  • The page cannot be found
  • We can’t find the page you’re looking for.
  •  the requested url was not found on this server. wordpress

The Error 404 not found message is treated suitably by many sites that fetch a custom page to cover the error and not just show one of the typical messages above.

Therefore, a visitor may not experience the error message at all since many sites rather deploy interesting or creative 404 pages.

404 error is problematic for your users’ experience but also harmful for your SEO positioning.

⭐ Negative Impact Of 404 Errors

More specifically, where a permalink issue is causing sitewide 404 errors, Google crawlers’ wont be able to penetrate through and index the site’s content. Consequently, one should immediately resolve 404 errors. There are a lot of experts out there stating that 404s will ruin your rankings and that you should fix them as soon as possible.

In addition to losing visitors who do not find what they are looking for, are giving negative signals to Google. First, it slows down Google robots, which then give less importance to your site.

In addition, if a page receives good quality external links and it no longer exists, all the popularity of the links is no longer transmitted correctly to the entire site. 404s have an impact on rankings. But not the rankings of a whole site. If a page returns a 404 error code, it means it doesn’t exist, so Google and other search engines will not index it. Pretty simple, right?

Do 404s Hurt SEO and Rankings of a Website?

You can discover 404 errors in Google Search Console or by installing a third-party plugin like Redirection which lists 404 errors.

If a user arrives on a page of a site with a 404 error via an internal link, an external link or even via social networks, he will be frustrated not being able to access the content he wanted to see.

This can give an unprofessional image to a brand and cause a future rejection on the part of the Internet user who will remember this bad experience.

⭐ How to Fix Error 404 Page Not Found in WordPress?

Because this error discloses inconsistency with a link, it can typically resolve the same by properly configuring and saving WordPress permalinks. You should also correct the linking structure using a .htaccess file.

1. Save Permalinks

It is a simple solution to fix 404 error in WordPress by saving WordPress permalinks. This will update .htaccess file with the correct configurations for WordPress website.

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

how to fix wordpress posts returning 404 error

Then, scroll down and click on Save Changes.

fix error 404 not found on wordpress site

Now try accessing the posts to see if the 404 error is fixed.

2. Manually Reset Permalinks

If saving the permalinks did not solve the 404 issues, then you can manually reset permalinks by editing the .htaccess file.

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

wordpress 404 error after changing permalinksAdd in one of the following codes, save, and upload the updated file to your server:

A) When WordPress Site in the Main Domain

If site is on the main domain, e.g. www.yoursite.com, add this code to .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 a new file, refresh your site and access posts/pages to see if this fixes the 404 issues.

B) If WordPress Site in a Subdomain

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) When WordPress in 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]

3. Set Up 301 Redirects for Moved or Renamed Content

The 301 redirect is the most effective solution for correcting 404 errors on your site. However, it must be done correctly, making sure to redirect to the right pages as appropriate:

  • The page with error 404 has been replaced on the site by a new page which has a different URL: We are redirecting directly to this new page.
  • The page with error 404 has not been replaced on the site: We are redirecting to a page with similar content. If no similar content exists, it is also possible to redirect to the category page of the old content. As a last resort, redirect to the home page (Do not do this systematically).
  • Before deleting a page and redirecting, be sure to check if it has backlinks (external links), visits and if it is still well-positioned in Google.

To begin, you can take the help of a free Redirection plugin to fix redirects from your WordPress dashboard. After installing and configuring the plugin, visit the “Tools” menu and select “Redirection” and then type the 404 page URL in the “Source URL” box and the new working URL in the “Target URL” box.

how to fix wordpress error 404 page not found

If you use a CMS like WordPress, it is possible to use a plugin like this one. It allows automatic redirection by indicating the old and the new URL without going through the .htaccess file.

Implementing 301 Redirects Manually

Manually in the .htaccess of your hosting panel, using the piece of code:

  • To 301 Redirect a Page:

RedirectPermanent /old-file.html http:// www.domain.com/new-file.html

  • To 301 Redirect an Entire Domain:

RedirectPermanent / http:// www.new-domain.com/

Once you have inserted the commands to 301 redirect your pages, you need to make sure that there is a blank line at the end of the file. Your server will read the .htaccess file line by line, which means you need to throw an “end line” character to signify that you’re finished. An easy way to do this is to put a blank line at the bottom of the file.

Now that you’ve cleaned up your 404 errors, you can now anticipate this type of problem by creating a well-designed custom 404 page. You can in particular take inspiration from Google which offers creations all more original than the others.

Edit .htaccess

You need to edit the .htaccess file (and add a snippet of code at the top) which can be done in a number of ways. You can either get it done through an FTP program’s edit mode or edit the file on your PC and then upload it to the server via FTP or you can do this via cPanel >> File Manager.

This is the code:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# End WordPress

WordPress 404 Error – Internet Explorer Cannot Display The Webpage

Sometimes your WordPress website works fine on other web browsers, except Internet Explorer. Indeed, IE ignores the 404 conditions since the dawn of IE.

However, a few weeks ago, Microsoft introduced a system update for IE7 and IE8 which can cause the 404 error to stop immediately on your website, even if your website returns valid content.

troubleshoot-and-fix-wordpress-404-error

The solution is simple. You will have to put the code in header.php which is located in your theme folder.

header(‘HTTP/1.1 200 OK’);

“The requested URL was not found on this server

Changing and Update WordPress Url in Database

Let’s assume you encounter the below error on your WordPress website.

“The requested URL was not found on this server. If you entered the URL manually, please check your spelling and try again.”

wordpress 404 page not showing

In such a scenario, visit your PHPMyAdmin, then locate your database name and select wp-option, e.g. blog → wp-option.

404 file or directory not found wordpress

Now change the URL like your website URL is https://www.abc.com/blog/ replace it to http://localhost/blog.

wordpress page not found but it exists

Related Read How to Backup WordPress Database Manually?

Fix WordPress 404 Not Found Error on Local Server

At the staging level, quite a few developers and designers install WordPress on their desktops and laptops by running a local server. To that effect, a general problem arises with using WordPress on a local server is that they find it difficult to get permalink rewrite rules to give desired results.

Despite fixing fix the permalinks for posts and pages, the website still shows the “404 Not Found” error.

error 404 not found - what does it mean & how to fix it

In this situation, you need to turn on the rewrite module in your WAMP, XAMPP, or MAMP installation.

Navigate to the taskbar and find the WAMP icon. After that navigate to Apache → Apache modules.

what is error 404 not found

It will enable a long list of modules that you can toggle on and off. Find the one called “rewrite_module” and click it so that it is checked.

how to fix 404 page not found error in wordpress

Then check out your permalinks again.

How to Create Your Own Error 404 Not Found Page

While you can do your best to prevent 404 errors by following the tips above, it’s impossible to entirely eliminate 404 errors because some things are just plain outside your control. It’s not uncommon for small WordPress sites to have thousands of 404 errors every month.

To provide a more user-friendly error page, you can use one of the many 404 page plugins. For example, the free 404 page plugin lets you set up a custom 404 error page with:

  • A search box
  • Important links
  • Contact information

But remember, keep your 404 page light for better performance.

Related Read – List Of WordPress Website Maintenance Tasks

Tools to Check/Monitor 404 Errors WordPress?

Adopting a foresighted approach, it’s crucial to analyze which requests are resulting in 404 errors at your site. This helps you in:

  • Find broken links that are directing visitors to a page or a site that is unavailable. Eventually, you can take all remedial steps to fix such broken links.
  • Understand which pages or pieces of content have difficulty, coming in the preview of Google crawlers. Then you can make necessary corrections primarily by setting up a redirect.
  • Troubleshoot issues and improve performance with regard to 404 errors.

Use WordPress Plugin

If you want to use a WordPress plugin, the aforementioned Redirection plugin can help you monitor for 404 errors from your WordPress dashboard.

 Use 404 error broken link checking Tools

You can also use a third-party audit tool like Ahrefs to monitor for 404 errors on your WordPress site. You can even set this up to run on a schedule.

Check every link on your website to determine whether the link leads to a 404 error using tools for checking broken links is the broken link crawl (or scan) tool.

Crawl tools:

  • Screaming Frog
  • SiteLiner,
  • SiteBulb

Use Analytics Tools

For example, you could trigger the following event onload of the error page:

ga('send', 'event', 'error', '404', location.pathname);

With the help of Google Analytics, you can set up a custom report to track 404 errors from external links.

Use Free broken link checker / dead links tools

  •  error404.atomseo  – A free web-based online tool for checking broken or dead links (404 errors)
  • Dead Link Checker: Free Broken Link Checking Tool
  • Brokenlinkcheck – Free Broken Link Checker Dead Link Checking Tool
  • chrome.google.com/webstore/detail/broken-link-checker/ –  find all broken links (404 errors) on the web page
  • Dr. Link Check: Broken Link Checker
  • Hexometer – Broken Links Scanner for 404 or Dead links

Find 404 error pages using search console google

Google Search Console is often used less. However, lastly, you can track 404 errors along with other important information about your site and its referencing is indicated there. Just go to Crawl → Crawl Errors, -Not found, to view a list of 404 errors that Google has encountered. This can also in particular help you to improve the user experience and the visibility of your website.

Find-404-pages-using-search-console-google

In most cases these solutions will fix the WordPress posts 404 error. However, if it does not work for you, then you may probably need help.


Get in touch with our team of WordPress Experts To Solve Errors on Your WordPress Site.


Other Useful Articles (In-Depth)

  • Fix This account has been suspended wordpress issue
  • How to disable directory listing in wordpress
  • WordPress hacked redirecting to another site how to clean it
  • How To Fix hacked Godaddy hosted site
  • Fix Japanese Keywords hack In WordPress Site
  • How to Remove Blackhat SEO Spam in WordPress Site?

WordPress 404 страница - как настроить

Рассмотрим, как настроить шаблон ошибки 404 в WordPress, чтобы создать полезную страницу, которая поможет пользователям сориентироваться на вашем сайте и улучшить поведенческие факторы.

Что такое ошибка 404 и почему важно правильно настроить страницу?

Ошибка 404 возникает, когда посетитель пытается получить доступ к странице, которая не существует. Многие склонны игнорировать эту страницу при использовании шаблонов WordPress и не задумываются о ее существовании. Тем не менее, если вы потратите время на создание удобной страницы 404, это поможет задержать пользователя на вашем сайте.

Интернет-адрес, ведущий на страницу с ошибкой 404, может оказаться просто неправильно набранным URL либо возникнуть со временем, если вы удалили проиндексированную страницу и забыли об этом. При выдаче кода 404 WordPress настроен на автоматический поиск файла 404.php. Базовый шаблон с этой ошибкой включен в некоторые темы WordPress. Если же этого файла нет, то будет показано системное сообщение, которое не несет полезной для пользователя информации.

Как создать страницу 404 ошибки, если ее нет в шаблоне — настройка

Не все темы WordPress имеют собственный файл шаблона ошибки 404. Если разработчик темы предусмотрел это, такой файл будет называться 404.php. WordPress автоматически использует эту страницу, когда возникает ошибка 404. Если в вашей теме нет этого файла, его можно создать самостоятельно.

шаблон 404 вордпресс

  1. Первое, что нужно сделать, это сформировать настраиваемый шаблон, например, редактируя файл 404.php, скопированный из другой темы. Если вы редактируете свою тему напрямую, настоятельно рекомендуется сделать резервную копию темы WordPress.
  2. Файл ошибки 404 расположен по адресу: /wp-content/themes/имя-темы/404.php
  3. Страница ошибки примет стиль активной темы, поскольку она вызывает шапку
  4. И подвал текущей темы.
  5. Понадобится только отредактировать заголовок и сообщение на странице в соответствии с вашими конкретными потребностями.
  6. Для этого откройте файл шаблона ошибки 404 в редакторе кода и измените текст сообщения на свое усмотрение.
  7. Добавьте в шаблон строку поиска, если ее там нет. Затем сохраните файл и загрузите его в каталог темы установки WordPress.

Поскольку все темы различаются, нет никакой гарантии, что простое копирование файла шаблона 404.php будет работать. Чтобы сервер нашел страницу 404, добавьте следующую строку в файл .htaccess:

ErrorDocument 404/index.php?error=404

Файл index.php расположен в корневой папке вашего сайта. Если WordPress находится в подкаталоге с именем «wordpress», код, добавляемый в файл .htaccess, должен быть:

ErrorDocument 404/wordpress/index.php?error=404

Что разместить на wordpress странице 404

Когда пользователь обнаруживает вместо искомой страницы сообщение об ошибке 404, разочарование может заставить его покинуть ваш сайт преждевременно. Задача веб-мастера помочь найти посетителю информацию, которую он искал, и тем самым снизить процент отказа и улучшить поведенческие факторы на сайте.

Рекомендуется указать пользователю правильное направление действий, которое заставит его задержаться на сайте. Это можно сделать несколькими способами:

  • предоставить информацию о других разделах вашего интернет-ресурса, которые можно посмотреть;
  • дать посетителю возможность связаться с вами по указанным контактным данным;
  • добавить ссылки на популярные сообщения, последние комментарии, архивы;
  • разместить строку поиска, чтобы посетитель сам нашел нужную информацию на сайте.

Чтобы сделать страницу уникальной, вы можете снабдить ее фоновым изображением в стиле оформления сайта. Допустимо также использовать html-теги и css-стили, чтобы придать шаблону индивидуальность.

Как создать в вордпресс 404 страницу при помощи плагина

Создать собственную страницу 404, как и любую другую страницу в WordPress можно при помощи плагина 404page (https://wordpress.org/plugins/404page/). Важной особенностью этого плагина является то, что он не создает перенаправление, а формирует правильный ответ сервера с кодом 404. Он сообщает поисковым системам, что страница не существует и должна быть удалена из индексирования, тогда как перенаправление приведет к HTTP-коду 301 или 302 и URL-адрес останется в индексе поиска.

Установите плагин 404page из меню админки «Плагин -> Добавить новый» и активируйте его.

плагин 404 вордпресс

Создайте страницу 404 как обычную страницу WordPress из меню «Страницы -> Добавить новую». Внесите в нее всю необходимую информацию, которую вы хотите показать посетителю, и нажмите кнопку «Опубликовать». Плагин 404page также добавляет CSS-класс error404 в тег <body>, который можно использовать для задания дополнительных стилей на странице.

страница 404 вордпресс

После активирования плагина в меню «Внешний вид» (1) появился раздел «404 Error Page» (2), в котором можно настроить отображение страницы ошибки.

Выберите созданную страницу 404 из списка страниц сайта (3). Убедитесь, что отмечен флажок (4), чтобы сервер отдавал код 404 при доступе к этой странице. Если вы используете кэширование, плагин выдаст предупреждение – страница из кэша будет отдавать код 200, поэтому ее нужно исключить из кэширования.

При возникновении проблем или конфликта с другими плагинами 404page может быть запущен в режиме совместимости. Нажмите кнопку «Сохранить изменения» (5).

настройка 404 вордпресс

Чтобы включить обработку ошибок 404 в WordPress, нужно установить структуру ссылок в меню «Настройки -> Постоянные ссылки» на любой пункт, кроме «По умолчанию». В противном случае ошибка 404 обрабатывается сервером, а не движком WordPress.

iPipe – надёжный хостинг-провайдер с опытом работы более 15 лет.

Мы предлагаем:

  • Виртуальные серверы с NVMe SSD дисками от 299 руб/мес
  • Безлимитный хостинг на SSD дисках от 142 руб/мес
  • Выделенные серверы в наличии и под заказ
  • Регистрацию доменов в более 350 зонах

WordPress. Ошибка 404

От автора: приветствую, вас, уважаемые читатели. 404 ошибка WordPress: что это? зачем? и почему? Из этой статьи вы узнаете ответы на эти вопросы, а именно: что такое 404 ошибка WordPress, как исправить ошибку 404 в WordPress и как, благодаря ошибке 404, подсказать пользователю, что он набрал неверный адрес.

Что же такое ошибка 404?

Начнем, пожалуй, с определения того, что же такое ошибка 404. Ошибка 404 — это стандартный код ответа сервера на ошибочный запрос. Этот код означает, что по данному адресу ничего нет: Not Found (не найдено). Прежде всего этот код необходим для поисковых роботов, чтобы сообщить им, что по данному URL ничего нет.

А нужна ли ошибка 404?

Здесь можно было бы ограничиться одним словом — нужна. Но давайте попробуем понять, зачем именно она нужна. На самом деле есть подход, применяющийся порой веб-мастерами, который состоит в следующем: при обращении к несуществующему адресу идет перенаправление на главную страницу сайта. Этот подход не очень хорош, поскольку так выходит, что на одну страницу — главную — ведут несколько ссылок. На эту ситуацию уже не очень хорошо могут отреагировать поисковые системы.

Вот для того, чтобы избежать возможных неприятностей, и существует ошибка 404, которая должна отправляться в ответ на ошибочный запрос. В этом случае мы говорим поисковому роботу, что такой страницы нет, и он должен удалить ошибочный адрес из поискового индекса.

Настройка страницы 404 в WordPress

Итак, мы выяснили, что страница 404 — нужна. Как же настроить в WordPress эту страницу и в чем заключается настройка 404 страницы? Собственно, зачастую нам не придется делать ничего особенного, поскольку в WordPress все уже сделано за нас. Все, что вам необходимо сделать — создать в папке активной темы новый шаблон (если его там еще нет), который так и называется — 404.php.

Далее этот шаблон мы можем оформить по собственному вкусу. Это может быть как шаблон в общем стиле сайта, так и кардинально отличающийся от общей стилистики. Вообще, оформление страницы 404 — довольно интересный и иногда даже занимательный вопрос. Многие сайты стараются выделиться, создавая страницы 404 с юмором, с т.н. «пасхальными яйцами», вставляя на эту страницу всевозможные занимательные картинки.

Бесплатный курс «Создание тем на WordPress. Быстрый старт»

Изучите курс и узнайте, как создавать уникальные темы на WordPress с нестандартной структурой страниц

Скачать курс

Это может быть как относительно простая, но со вкусом оформленная страница ошибки 404, например, как на Гитхабе:

Так и довольно сложная, великолепная и оригинальная страница студии дизайна Bluedaniel — www.bluedaniel.com/404:

Ради интереса вы можете обратиться к поиску по картинкам Google, набрав простой поисковый запрос — 404. В ответ Вы найдете массу интересных и креативных картинок, которые используются для оформления страницы 404.

WordPress — 404 не работает…

Иногда вы можете столкнуться с такой ситуацией, что шаблон 404.php есть, но он почему-то не срабатывает, т.е. WordPress при возникновении ошибки 404 просто не подключает этот шаблон. Такое иногда случается и связано с настройками сервера.

Как же исправить эту ситуацию? Очень просто. Найдите в корне вашего сайта (рядом с папкой wp-content) файл .htaccess и добавьте в этот файл следующую строку:

ErrorDocument 404 /index.php?error=404

Эта строка заставит сервер при возникновении ошибки 404 обращаться по нужному адресу. Ну а WordPress уже подключит страницу 404. Если вдруг вы не найдете в корне сайта файл .htaccess, тогда создайте его самостоятельно. Сделать это можно через любой редактор кода (например, Notepad++).

Ошибка 404 — что делать?

До этого мы с Вами рассматривали оформление страницы 404 в WordPress. Но что делать, если на вашем сайте только и присутствует страница 404? Т.е. работает только главная, а при попытке перейти на любую другую страницу вы получаете в ответ ошибку 404 в WordPress? Да, такое тоже иногда бывает. Но не спешите кричать «Караул!» и переустанавливать WordPress. Можно попытаться решить проблему своими силами.

Вполне возможно, что почему-то произошла ошибка с настройками постоянных ссылок в WordPress. Попробуйте зайти в меню Параметры — Постоянные ссылки и просто нажмите кнопку Сохранить изменения. В большинстве случаев это поможет решить проблему с постоянной ошибкой 404 в WordPress.

Если первая рекомендация не помогла, тогда проверьте наличие в корне сайта упомянутого ранее файла .htaccess. Откройте этот файл и проверьте, присутствуют ли в нем вот эти строки:

# BEGIN WordPress

&lt;IfModule mod_rewrite.c&gt;

RewriteEngine On

RewriteBase /

RewriteRule ^index.php$ [L]

RewriteCond %{REQUEST_FILENAME} !f

RewriteCond %{REQUEST_FILENAME} !d

RewriteRule . /index.php [L]

&lt;/IfModule&gt;

# END WordPress

Если вдруг этих строк там не окажется, тогда добавьте их. Этот способ также должен помочь решить проблему постоянной ошибки 404 в WordPress.

Друзья, надеюсь, ознакомившись со статьей вы исправили ошибку 404 в WordPress и смогли настроить страницу 404. Если у вас возникли какие-либо вопросы — не стесняйтесь их задавать, мы попробуем ответить на них.

Бесплатный курс «Создание тем на WordPress. Быстрый старт»

Изучите курс и узнайте, как создавать уникальные темы на WordPress с нестандартной структурой страниц

Скачать курс

Создание тем на WordPress. Быстрый старт

Изучите курс и узнайте, как создать тему на WordPress

Смотреть

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Вот блиц ошибка 0х00000007
  • Ворота дорхан ошибки
  • Вордпресс как изменить фон блока
  • Вот блиц на пк как изменить разрешение экрана
  • Вордпресс как изменить страницу входа

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии