HTTP Response Codes: Understand How Your Web Server Responds to Requests
Every time a user makes a request to a web server, the server responds with a numeric code. This code indicates the status of a web page. These codes are also used by search engine bots, so they are important for your web server rank. If you’re new to SEO and need to know why you should know status codes, take a class at Udemy.com and learn the technical side to SEO.
How Does a Web Page Render in a Browser?
Before you get to know HTTP status codes, you should know how a web page renders in the browser. Understanding this process will help you identify if any problems stem from the local computer or network or your web server. But before you can trace these problems, you need to know how your browser accesses a web server.
Open a browser and type a URL into the address bar. Notice that the browser tells you it’s trying to contact the web server. This is when the browser does a lookup for the IP address. This lookup occurs using domain name servers (DNS). DNS servers hold a database of records that include the domain name and the domain’s associated IP. DNS servers perform other actions, but this is the one you’re concerned with when you’re understanding web server connections.
After the browser gets an answer from the DNS server, the browser can now use the IP address to make a connection to the server. Typically, if you just type a domain name URL into the browser, the server returns the default page listed in the site’s configurations. This is typically index.php for Linux servers.
The default port for web servers is 80. You don’t need to specify a web server port when you type a URL into the browser. If the web server only allows web connections on an alternative port, you must specify this port with a colon and port number after the URL.
Server Response 200 or OK
The most important server response is the 200 response code. 200 translates to “OK” from your server to the web browser. This is the response you want to have when your users access any page. There are other legitimate responses that won’t cause a problem, but the ultimate response you want users to get is OK.
200 response codes are also picked up by search engine bots. When a page returns a 200 response code, the bot will most likely index the page in search results. Search engines such as Google have a “Fetch as Googlebot” tool to ensure that your servers response appropriately to a search engine crawler.
One mistake some new webmasters make is to set a 200 response for a missing page. This is a mistake. You only want to show a 200 response code when there are no errors including physical page location and any coding mistakes.
301 Response: Page Has Permanently Moved
How do you tell browsers and bots that you want to move your website? You use the 301 response code. This response code tells both browsers and bots that the page has permanently moved. It’s probably more important for bots than browsers. Browsers don’t care if you use a 302 (temporary move status code) or a 301. However, search engine bots use 301s to indicate that you want to permanently move your site.
When you implement a 301, you can use tools such as web-sniffer.net to verify that the site really does redirect without errors. Browsers will automatically open the new URL. Bots will associate the new page for the old page.
302: Temporarily Move Your Pages
A 302 response code indicates to the browser or a bot that the URL move is temporary. Again, browsers will redirect your pages whether it’s a 301 or a 302. However, for search engine bots and SEO, the difference is significant.
When you set a 301 redirect on your pages, search engines think you want to permanently move the page, so the old pages are replaced with the new pages. This means that your old URLs will disappear eventually and these URLs are replaced with the new ones. When you 302 redirect, you tell bots that it’s temporary. Bots crawl the new content but keep the old content in the search results. This means that duplicate content is an issue with these redirects.
It’s a common myth that Google does not pass PageRank with 302 redirects. Both 301 and 302 redirects pass PageRank, so you must be careful when redirecting pages that have any penalty including link penalties or Penguin issues.
Page Missing? Use a 404 Response
What happens when you delete a page? The server automatically responds with a 404 code. A 404 code means that the page is temporarily missing. Search engine bots will continue to crawl 404 error codes, so you can use a 410 response code when you’re positive that you no longer want the page. For the most part, 404s are the typical server response for a missing page. They are useful if you accidentally delete a page and replace it with a new page. The bots crawl the page and come back later to see the new page.
The best 404 pages are customized. The server has a default page with no information other than the page is missing. This means you lose the user when he bounces from your web pages. You can help salvage search engine traffic by creating a customized 404 page. This customized page has the same CSS layout but it directs users to possible related content to help keep the user on the site.
If you know you want to remove a page, the best advice for SEO is to use a 301 redirect for the missing page. This means instead of showing a 404 to bots and users, both are redirected to the new relevant page. For instance, suppose you delete a product page for an old version. You can 301 redirect bots and users to the new version’s page. This means that your old product that you no longer carry won’t be indexed, but you’ll have a chance to still make a sale with the new product.
503 Error Code
When you want to bring down your site temporarily, the proper way to respond to bots and users is with a 503 response code. You can also set up a customized 503 page for your users. This means that your users will see the error but see the customized message that you want them to see.
For bots, it indicates that you’re temporarily down. This code is typically used when you want to perform maintenance on a server and need to bring it down for a temporary amount of time. Search engines see this error and will come back frequently to check when your site is back up.
This isn’t a complete list of server response codes, but they are the ones most important for website maintenance and performance. You should periodically check your web server to ensure that you’re returning the right code. Some site owners have their sites hacked and the malicious content redirects bots and users to other URLs. You might not even notice that your pages are missing. Random checks on your website help you identify any issues. When you check your server, use more than just a browser. Use server header tools such as Fetch as Googlebot or websniffer.net to find any incorrect server response codes.
Empower your team. Lead the industry.
Get a subscription to a library of online courses and digital learning tools for your organization with Udemy Business.