Tag Archives: MOD_REWRITE

.htaccess 301 Redirect

.htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis in an Apache HTTP Server. This file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.

This 301  Redirect can be used anytime you want to redirect a URL. Here are some examples of its use:

  • Single page – Redirect 301 /old_page.html http://www.mysite.com/new_page.html
  • entire site -   Redirect 301 /  http://www.new_site.com/
  • change file extension (html to php in this case) -  RedirectMatch 301 (.*)\.html$ http://www.mysite.com$1.php

There are many other uses for Redirect 301 and mod_rewrite on Apache, if you are moving a site or redesigning a site with a new CMS make sure you redirect your old URLs to your new site. By failing to do so any user that clicks on a link to your old site (page) will hit a 404 ERROR page, this will affect your search rankings. 

The book “Professional SEO” has a good chapter in mod_rewrite and URL redirection, and is also great SEO manual

For a full tutorial on .htaccess visit the official Apache website.

Technorati Tags: , , , , , ,

Search Engine Optimization SEO in PHP (Book)


The term SEO (Search Engine Optimization) has become a new phenomenon with marketeers.  As a programmer/developer it’s very hard to find a good book on such a broad subject but recently I found this great book. The authors go about explaining and guiding you through exercises that are relevant for both programmers and marketeers.  It contains detailed chapters on Website Content, Links, Webmaster tools and MOD_REWRITE. The code snipets found in this book can be used as a good reference guide to any SEO project.  This book is for PHP Programmers but they have also published a .NET version.

If  you develop with WordPress.org this releted post can also be very helpfull:  SEO and WordPress

Technorati Tags: , , , , ,