Chapter 4. Content Relocation and HTTP Status Codes

One of the perks of PHP is that it abstracts away many low-level implementation details from the web developer. It does such a great job, in fact, that you can typically build complex web applications without understanding much at all about the protocol web servers used to speak to the world, HTTP (Hyper Text Transport Protocol).

Though most of the time this ignorance is bliss, it is sometimes not so with regard to search engine optimization. Using the protocol improperly has the potential to wreak havoc for search engine rankings. On the other hand, knowing how to use it effectively can be of great help to the very same end.

HTTP status codes are a small but critical part of this protocol. They provide information regarding the state of an HTTP request. You can use them, for example, to indicate that the requested information should be retrieved from a different location henceforth. In modern search engines, doing so also may also result in a transference of link equity to that new location. This example alone highlights the importance of knowing how to use these codes.

In this chapter you will:

  • Learn about the HTTP status codes that are pertinent to the search engine marketer.

  • Understand how to use the redirection status codes properly, how to signal deleted pages, and how to avoid indexing errors.

  • Learn how to implement redirection using PHP and mod_rewrite.

  • Follow step-by-step exercises to implement automatic URL correction and canonicalization. ...

Get Professional Search Engine Optimization with PHP: A Developer's Guide to SEO now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.