Understanding HTTP Status Codes
Last Updated: 2025-01-01
3 min read
Understanding HTTP Status Codes
HTTP status codes are three-digit numbers that a web server sends in response to a browser’s request. Understanding these codes helps you diagnose website issues and communicate effectively with your hosting provider.
Status Code Categories
| Range | Category | Meaning |
|---|---|---|
| 1xx | Informational | Request received, processing continues |
| 2xx | Success | Request successfully received and processed |
| 3xx | Redirection | Further action needed to complete the request |
| 4xx | Client Error | Error in the request from the browser |
| 5xx | Server Error | Server failed to fulfill a valid request |
Common Success Codes (2xx)
- 200 OK: The request was successful. This is the standard response for a successful page load.
- 201 Created: A new resource was successfully created (common in API responses).
- 204 No Content: The server processed the request but returned no content.
Common Redirection Codes (3xx)
- 301 Moved Permanently: The resource has permanently moved to a new URL. Search engines transfer link equity to the new URL.
- 302 Found (Temporary Redirect): The resource is temporarily at a different URL. Search engines keep indexing the original URL.
- 304 Not Modified: The resource hasn’t changed since the last request — the browser can use its cached version.
- 307 Temporary Redirect: Similar to 302 but preserves the HTTP method of the original request.
- 308 Permanent Redirect: Similar to 301 but preserves the HTTP method.
Common Client Error Codes (4xx)
- 400 Bad Request: The server can’t process the request due to malformed syntax.
- 401 Unauthorized: Authentication is required and has failed or not been provided.
- 403 Forbidden: The server understood the request but refuses to authorize it. Check file permissions.
- 404 Not Found: The requested resource doesn’t exist. Check URLs and set up a custom 404 page.
- 405 Method Not Allowed: The HTTP method used is not supported for the requested resource.
- 408 Request Timeout: The server timed out waiting for the request.
- 429 Too Many Requests: Rate limiting — too many requests in a given time period.
Common Server Error Codes (5xx)
- 500 Internal Server Error: A generic error indicating something went wrong on the server. Check error logs for details.
- 502 Bad Gateway: The server received an invalid response from an upstream server.
- 503 Service Unavailable: The server is temporarily unable to handle the request (maintenance or overload).
- 504 Gateway Timeout: The server didn’t receive a timely response from an upstream server.
How to Diagnose HTTP Errors
- Check browser DevTools: Press F12 → Network tab to see status codes for every request.
- Review server error logs: Access
error_logvia cPanel’s File Manager or FTP. - Test with cURL: Run
curl -I https://yoursite.comto see response headers. - Use online tools: HTTPstatus.io or Redirect Checker can help trace redirect chains.
Fixing Common Issues
| Error | Common Causes | Solutions |
|---|---|---|
| 403 | File permissions, .htaccess rules | Fix permissions (644 for files, 755 for directories) |
| 404 | Broken links, deleted pages | Set up redirects or fix URLs |
| 500 | PHP errors, corrupted .htaccess | Check error log, rename .htaccess to test |
| 502/504 | Server overload, PHP timeout | Increase timeout limits, optimize code, upgrade hosting |
Tags:
website
http
status-codes
errors
troubleshooting