What Are HTTP Status Codes? 200, 301, 404, 500 and Troubleshooting
Updated: November 6, 2026 · AracMerkezi
▶ Open HTTP Status Codes Reference
An HTTP status code is the three-digit number the server gives at the start of every response, and its first digit tells you whom the problem lies with: 2xx success, 3xx redirection, 4xx request side, 5xx server side. Instead of listing the codes like a dictionary, this guide explains how to solve "why won't this page open?" step by step, how to see the code with curl, how to calculate the cost of redirect chains, and which code to use when moving a site. The command outputs below were verified by running them against a local test server.
Five classes
| Class | Meaning |
|---|---|
| 1xx | Informational |
| 2xx | Successful |
| 3xx | Redirection |
| 4xx | Client error (problem on the request side) |
| 5xx | Server error |
The most common codes
- 200 OK: The request succeeded and the page was returned.
- 301 Moved Permanently: The page has permanently moved to a new address; search engines index the new address.
- 302 Found / 307: Temporary redirect; the old address may stay in the index.
- 304 Not Modified: The cached copy is still valid.
- 400 Bad Request: The request could not be understood.
- 401 / 403: Authentication required / no permission to access.
- 404 Not Found: The page was not found.
- 410 Gone: The page has been permanently removed.
- 429 Too Many Requests: Too many requests were sent.
- 500 Internal Server Error: An unexpected error on the server.
- 502 / 503 / 504: Gateway and temporary service problems.
Example 1: Seeing the code from the command line
Our test server was set up so that /yok returns 404, /hata 500 and /yeni 200. The command that prints only the code:
curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8765/yok
Output: 404. The same command gave 500 for /hata and 200 for /yeni. To see the headers use curl -I address; in the headers of our maintenance page we saw the line HTTP/1.0 503 Service Unavailable (the first line of the header). In the browser, open the Network tab with F12 for the same information; the code is shown next to each request.
Example 2: Following a redirect
Say the /eski address is redirected to /yeni with a 301.
curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8765/eski→301(without following the redirect).curl -L -s -o /dev/null -w '%{http_code} %{num_redirects} %{url_effective}' http://127.0.0.1:8765/eski→200 1 http://127.0.0.1:8765/yeni.
So with -L one redirect was followed and the final status was 200. A search engine bot likewise sees the 301 and records the new address.
Example 3: How much does a redirect chain slow things down?
Every redirect means a separate request-response round trip for the browser. Say one round trip takes 80 ms (hypothetical).
- Direct A → C: 1 trip (the target page) = 80 ms.
- Chain A → B → C: 2 redirects + 1 target = 3 trips = 240 ms.
- Difference: 160 ms, i.e. extra waiting before the page content arrives.
The longer the chain, the bigger the difference on mobile connections. The fix is to redirect all old addresses directly to the final destination.
Example 4: Counting 404s when moving a site
Say the site you are moving has 1,200 pages and the share you cannot match on the new site is 3% (hypothetical). 1,200 × 0.03 = 36 addresses are left without a match. If some of these receive external links, returning 404 wastes the link value. For these, give a 301 to the closest content; for those with no equivalent at all, deliberately leave a 404 or 410.
Example 5: Catching the code in Python
The call urllib.request.urlopen('http://127.0.0.1:8765/yok') raises an error for a 404; the error object's code attribute gives 404 (we saw this by running it against our test server). When you open /eski, on the other hand, the library follows the redirect automatically and the status attribute returns 200. This shows that in automated scripts the assumption "200 came back, so everything is fine" can be misleading because of redirects: look at how many redirects were made along with the final status.
Troubleshooting order
- Look at the first digit of the code: if it is 4, examine the address, permissions or request format; if it is 5, examine the server.
- If it is 3xx, follow the chain with
curl -Land count how many steps it takes. - If it is 404, check the spelling of the address, letter case and the trailing slash.
- If it is 403, examine file permissions and access rules.
- If it is 5xx, look at the server log; the error message is usually written there.
- If you made changes, test again while bypassing the browser cache.
What matters for SEO?
- Use 301 for pages you have moved; link value is passed to the new address.
- Return deleted pages with a real 404 or 410 code. Showing an error page but returning 200 (soft 404) misleads search engines. On our test server
/yokgave 404; had it given 200, that would have been a soft 404. - Persistent 5xx errors can lower crawl frequency; fix server problems quickly. In planned maintenance, sending a
Retry-Afterheader with503tells bots when to try again (our test server sentRetry-After: 120). - Avoid long redirect chains: use A → C instead of A → B → C.
301, 302, 307, 308: which one?
| Code | Permanent? | Method preserved? | Typical use |
|---|---|---|---|
| 301 | Yes | Browsers may often change it to GET | Permanent move |
| 302 | No | Browsers may often change it to GET | Temporary redirect |
| 307 | No | Yes | Temporary, POST must be preserved |
| 308 | Yes | Yes | Permanent, POST must be preserved |
Common mistakes
- Confusing a temporary redirect (302) with a permanent move.
- Returning an error page with 200 (soft 404).
- Redirecting every deleted page to the home page; search engines may treat this like a soft 404.
- Confusing 401 with 403: 401 says authentication is required, 403 says you lack permission even if authenticated.
- Only refreshing the page on 5xx errors; the server log should be checked.
- Not lowering the request rate after getting a 429.
How do you see the status code?
Open the developer tools (F12) in the browser and look at the Network tab, or use curl -I. The page indexing report in Search Console also lists errors on your site.
For explanations of the codes see the HTTP Status Codes Dictionary tool. To split an address into parts the URL Parser helps, and for file types the MIME Type Finder. See also the guide URL Slug for address structure.
Frequently asked questions
What is the difference between 301 and 302?
301 is a permanent move; search engines index the new address and pass on link value. 302 is temporary; the old address may stay in the index. Use 301 for a permanent move.
What is a soft 404?
It is when the server returns 200 instead of 404 for a page that does not exist; search engines may treat the page as if it were real. Deleted pages should return a real 404 or 410.
What is the difference between 500 and 503?
500 reports an unexpected error on the server. 503 says the service is temporarily unavailable, and a Retry-After header can indicate when to try again.
Tools mentioned in this guide
More guides
- What Is curl? Basic Flags and Converting a curl Command to fetch – What is curl and what do the -X, -H and -d flags do? A POST request example, the JavaScript fetch equivalent of a curl command, and debugging tips.
- What Is Regex (a Regular Expression)? A Beginner's Guide with Tested Examples and Common Mistakes – What is regex, and what do \d \w + * [] () mean? Date, phone and email examples, greedy matching, the Turkish letter issue and a ReDoS warning.
- What Is chmod? Linux File Permissions 755, 644 and 777 Explained: Reading ls -l, umask and Examples – What is chmod? Read ls -l output, understand 755 644 600 777, symbolic mode, umask and special bits. Commands were run and verified.
- What Are an IP Address, CIDR and a Subnet Mask? How Many Addresses Is /24? A Calculation Method – How do you calculate CIDR notation and subnet masks? The block-size method, network and broadcast addresses, splitting into subnets and private ranges.
- What Are the Most Common Port Numbers? 22, 80, 443, 3306, and More – What is a port, and how do TCP and UDP differ? A table of common ports such as SSH 22, HTTP 80, HTTPS 443, and MySQL 3306, plus basic port security tips.
This article is for general information only and is not legal, financial or medical advice. We are not an official institution.