URL rewrites and 301 redirects... you talk about them, you recommend them, but do you truly understand how they work? Sure, you know that rewriting a URL means that the URL displayed in the browser changes to be more SEO (and user) friendly. And you know that a 301 redirect is a permanent redirect. But let's dig a little deeper, and explain how they work together.



As a developer, my very first SEO project was the task of rewriting a massive number of URLs and ensuring that the old URL redirected to the new. It was a daunting task at first because I didn't have a clear understanding of how it all worked together. I was sure I'd have to rewrite pages and pages of code, and spend weeks if not months on the project. But once I figured it all out, the light bulb went on, and it literally took just a couple days to get it right. Yep! Days.



URL Rewrites

Rewriting a URL means changing the way the URL is displayed in the browser. When a user lands on a page with a rewritten URL, the code behind that page doesn't change. In fact, the server still reads the original URL.



URL Rewrite Process:

  1. User lands on new SEO'd URL
  2. Using mod_rewrite, ISAPI_Rewrite, etc. new URL points to old URL on the server
  3. Server calls the code from the old URL
  4. Page is displayed in browser, displaying the new URL

URL Rewrite explained


From the server's perspective, nothing has changed. The code is still the same. For example, if a developer had built a site using URL variables, there's no need to change any code. Now, there are always cases that could contradict this. But at the basic level, there shouldn't be a need to change code on the page.



301 Redirect

Once the URL is rewritten, you want to make sure that the old URL 301 redirects to the new. This tells the search engines that any link equity the old URL had should now be given to the new URL. It also makes for a good user experience, rather than showing a 404 error page. The server is told URL A should now be URL B.


301 Redirect Process:

  1. User lands on original URL
  2. Using code, mode_rewrite, etc. the 301 redirects URL to the new one, literally changing the URL that is displayed in the browser from the old to the new
  3. URL Rewrite process begins again

301 Redirect and URL Rewrite

Using the rewrite and redirect together brings the solution full circle. I've trained many developers on SEO standards and specifically how to implement and understand the workings of the rewrites and redirects. It takes a bit to wrap your head around it, but it's all really quite simple.



For more detailed information on rewrites and redirects, check out the following sites:

Personally, I find it fascinating and enjoy helping SEO's as well as developers "see the light," as I like to call it. It's that "aha" moment when they realize how simple it all is, and how easy it is to make your site SEO friendly. The best part is that rewriting URLs also helps to improve user experience. I'd love to hear if you have something to add, or how you go about explaining how these functions work together.