|Ankit Singh (Dev)|
Sometime when you visit a website or webpage, it shows you an error with a code like 404, 500, or different. And many of you need to know what is the actual meaning of this code? or why I’am seeing this error. Let me explain this simply, the codes you saw on the webpage is known as HTTP status code or HTTP response code or HTTP message.
These are the five different classes of response codes: 1xx (Informational), 2xx (Success), 3xx (Redirection), 4xx (Client Error) and 5xx (Server Error). Even you work in any industry, but I know the internet is part of all industries in the world. You must know the means of HTTP status codes, but it’s hard to learn the meaning of all codes, that’s why I list the most common HTTP codes with simple meaning and example.
1. 301 Moved permanently
HTTP response code 301 means the URL requested by the client is moved permanently to a new location. For example – The admin of the website changes an page permalink from Example.com/old to Example.com/new. But, the old link getting clicks from search engines and external pages and it showing page not found. To fix this problem, the admin redirects the old link to new link using 301 redirection.
2. 400 Bad request
HTTP response code 400 means the web server didn’t understand the request sent by the client browser and the request was malformed. For example – You want to request an URL called Example.com/page but mistakenly you type Example.com/*page in the address bar. As you go, the browser will show you 400 bad request because you add an invalid syntax “*” in the URL.
3. 403 Forbidden
HTTP response code 403 means you don’t have permission to access the requested resource for some reasons but the request is valid. If you’re confused between 401 unauthorized vs 403 forbidden, then let me clear that 401 indicates that the request required authentication and 403 indicates that the server is refusing to fulfill your request even you authenticate or not. For example – You don’t have permission to access Example.com/directory/private/ but you can access Example.com/directory/public/.
4. 404 Not found
HTTP response code 404 means you have a valid connection with the website or server, but the server was unable to find the requested resource such as webpage or file. For example – A webpage /page/ was removed from website Example.com, but still you request Example.com/page/ from your browser and the server will give you 404 error message. According to Google, it was the most common error,.
5. 408 Request timeout
HTTP response code 408 means the client request was too longer or the request reached the maximum wait time of the server. The connection was closed and the client may repeat the request without any modification. For example – If the admin set maximum 20 seconds timeout in the server, then your connection with the server will be aborted after 20 seconds.
6. 451 Unavailable for legal reasons
HTTP response code 451 means the client request an illegal resource that censored by a government, such as webpage or website. It is a variant of 403 Forbidden. For example – A website called Example.com/movie/ contains copyrighted content or illegal content that violating laws. The court will order to censor the webpage or website that contains illegal contents.
7. 500 Internal server error
HTTP response code 500 means something is going wrong that server can’t explained or the server encountered an unexpected condition. This is the most common HTTP response message, according to Google. For example – The website Example.com is getting too much traffic that the server can’t handle and it was replying internal server error to all visitors.
8. 502 Bad gateway
HTTP response code 502 means the server is acting as a gateway or proxy and it can’t fulfill the client request because it didn’t get a valid timely response from the upstream server. For example – There is a broken connections or server side crash that causes bad gateway if accessed via a gateway or proxy.
9. 503 Service unavailable
HTTP response code 503 means the server is temporarily unavailable to handle the request because it is down for maintenance or overloaded. For example – The admin is performing some maintenance on the server or editing source files. The connection will come back after the maintenance goes completed.
10. 504 Gateway timeout
HTTP response code 504 means same as 502 Bad gateway. But, the only difference is that 502 error indicates invalid response from the upstream server, and 504 error indicates no timely response at all within a specific time frame from the upstream server.
Attribution: Icons provided by Flaticon