How to avoid soft 404 in the website during SEO
This article shares an SEO problem, soft 404. A status code we often see on websites is 404. Whether we develop a website or not, this is a problem we have to face.
What is a soft 404?
Before talking about soft 404, we must first understand what 404 is. 404 is an HTTP status code , which means that the page is not found. In simple terms, when we visit a web page, if the URL we requested does not have a corresponding resource, the website will return us "404 Page Not Found".
HTTP is not the purpose of this article. You can check the HTTP tutorial to learn more about HTTP basics.

By default, if we visit a non-existent link, the web server will return us a page like the one above (Nginx). However, if we are a website operator, we will find that directly returning this page to users will definitely reduce the quality of our website.
In view of this, we usually define a 404 page ourselves. The 404 page of my own website looks like this.
Visit https://www.jiyik.com/a.html
Soft 404
That’s all we have to say about 404. Now let’s mainly talk about soft 404. When I first started building a website, I didn’t understand the concept of soft 404. At first, I just wanted to customize the 404 page to improve the user experience. But there is a problem that I didn’t notice. If it is purely static, you can directly configure your own 404 page through web services such as Ningx or Apache. There is no problem with this. But if it is a dynamic page, we need to determine in the code whether the resource requested by the user exists. If it does not exist, we directly render a 404 page through the template engine. Let’s take a quick look at the code.
if (count($res) <= 0) {
$this->displayError("404");
return;
}
Here I access a tutorial content that does not exist, and a 404 page is returned
So here comes the problem. Here we return a 404 page to the user, but the HTTP status code we give is 200
. Although the user does not feel anything, for SEO, search engines will think that you are cheating. (Actually, I am a SEO rookie, I really don't mean to deceive you)
The above situation is the protagonist we are going to introduce today, soft 404. The so-called soft 404 means that a 404 page is displayed to the user, but the actual HTTP status code is 200.
So to solve the problem of soft 404, it is actually very simple. Just return a 404 page to the user and change the response status code to 404 or 410. This depends on the programming language used for your website. However, no matter what language it is, the core is still the HTTP protocol.
For PHP, it is actually quite simple. You can header
modify the response status code by
header("status: 404 Not Found");
After the modification, when requesting the same address again, the custom 404 page is returned and the status code also becomes 404.
Summarize
Developing and maintaining a website is not easy. If it is just developed, it is not a difficult task for a programmer. But many details need us to do them carefully. I am a developer, and I am really a novice in SEO. I will learn and modify it while doing it. If you are not a developer, if you want to build a good website, whether it is using CMS or other frameworks, you hope to understand the HTTP protocol. Now we have entered the era of HTTP2.0. If you are interested, you can also learn about the past and present of HTTP2 and the shortcomings of HTTP1.1
Recommended reading:
For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.
Related Articles
How to redirect a website from HTTP to HTTPS
Publish Date:2025/03/16 Views:117 Category:NETWORK
-
HTTPS is a protocol for secure communication over computer networks and is widely used on the Internet. More and more website owners are migrating from HTTP to HTTPS, mainly due to the following 5 reasons: Google announced that websites usi
How to Fix the “SSL Handshake Failed” Error (5 Methods)
Publish Date:2025/03/16 Views:96 Category:NETWORK
-
Installing a Secure Sockets Layer (SSL) certificate on your WordPress site enables it to use HTTPS for a secure connection. Unfortunately, there are a lot of things that can go wrong in the process of verifying a valid SSL certificate and e
Detailed introduction to Let's Encrypt
Publish Date:2025/03/16 Views:129 Category:NETWORK
-
Let's Encrypt is a free, automated, and open certificate authority that officially launched in April 2016. It was originally founded in 2012 by two Mozilla employees. Their goal for founding Let's Encrypt was really simple; to encrypt the e
HTTP2 Tutorial - The Past and Present of HTTP2
Publish Date:2025/03/16 Views:73 Category:NETWORK
-
HTTP was originally proposed by Timberners-Lee, a pioneer of the World Wide Web, who designed the application protocol with simplicity in mind to perform advanced data communication functions between web servers and clients. The first docum
HTTP2 Tutorial - The shortcomings of HTTP1.1
Publish Date:2025/03/16 Views:145 Category:NETWORK
-
HTTP 1.1 is limited to handling only one outstanding request per TCP connection, forcing browsers to use multiple TCP connections to handle multiple requests simultaneously. However, using too many TCP connections in parallel can cause TCP
HTTP2 Tutorial - HTTP2 Functional Upgrade
Publish Date:2025/03/16 Views:87 Category:NETWORK
-
Before we officially introduce the functions of HTTP/2, let's take a detour to understand the past and present of HTTP/2 . Multiplexing Streams The bidirectional sequence of text-formatted frames sent via the HTTP/2 protocol exchanged betwe
HTTP2 Tutorial - How to use HTTP/2 with HTTPS
Publish Date:2025/03/16 Views:84 Category:NETWORK
-
HTTPS is used to build ultra-secure networks connecting computers, machines, and servers to handle sensitive business and consumer information. HTTP/2 browser support includes HTTPS encryption, which actually complements the overall securit
HTTP2 Tutorial - How to Configure HTTP2 with Nginx
Publish Date:2025/03/17 Views:195 Category:NETWORK
-
HTTP2 was officially released in 2015. If your website is still using HTTP/1.1, you may be out of date. Don't worry, here we will see how to use Nginx to upgrade your website to HTTP2. Install Nginx I feel that this column is redundant. Sin
OAuth2.0 - A comprehensive understanding of OAuth2.0
Publish Date:2025/03/17 Views:72 Category:NETWORK
-
When I first came into contact with OAuth2.0, I often confused it with SSO single sign-on. Later, due to work needs, I implemented a set of SSO in the project. Through my gradual understanding of SSO, I also distinguished it from OAuth2.0.