URL Rewriting with .htaccess and Apache to boost Search Engine Optimization

Bookmark and Share

URL Rewriting has been around for over a decade and can be seen at your favorite blog or a popular e-commerce website. However, in the last few years it has been widely used as it can be a great boon to Search Engine Optimization. Whether you want to “clean up” a URL or you want to boost search engine rankings by injecting keywords into a URL, URL rewriting is a simple process with .htaccess.

URL rewriting example:

URL rewriting is a great way to give a URL more meaning. Let’s say you have a page with a list of items that are for sale and this list is created dynamically via records from a database. When a user clicks on the link of an item they are brought to a page that has more detail about the item (think of the eBay search listings). Many times the URL will look something like this:

http://someurl.com/sale/index.php?item=iPod-shuffle

With URL rewriting you could turn that ugly link into:

http://someurl.com/sale/product/iPod-shuffle/

or

http://someurl.com/sale/product/iPod-shuffle.htm

Why use URL rewriting:

Using one of the latter examples instead of the original will be a boost to your search ranking because a search engine thinks it sees a static link instead of a dynamic link (which can weigh less in search engine algorithms). Moreover, you are taking important information about the page out of the query string and injecting it into the page section or directory section of the URL.

How do you accomplish URL rewriting?

Here’s a quick example on how to accomplish URL rewriting with .htaccess and Apache using the example above:

Example .htaccess file

Options –MultiViews
Options +FollowSymLinks

RewriteEngine on
RewriteBase /sale/
RewriteRule product/(.*)/ index.aspx?item=$1
RewriteRule product /(.*) index.php?item=$1

This above code will turn URL “A” into URL “B”.

URL A: http://someurl.com/sale/index.php?item=iPod-shuffle

URL B: http://someurl.com/sale/product/iPod-shuffle/

Note, that in this example, the .htaccess file needs to be placed in the /sale directory.

Good luck with URL Rewriting.  Please contact us with any questions or comments.

2 Responses to “URL Rewriting with .htaccess and Apache to boost Search Engine Optimization”

  1. [...] one of our recent posts, we wrote about the importance of using URL rewriting.  In the posts we demonstrated URL rewriting using Apache, Linux, and htaccess.   While Apache [...]

  2. [...] URL Rewriting with .htaccess and Apache to boost Search Engine Optimization [...]

Leave a Reply

Security Code:

129 Web Design · PO Box 18207 · Portland, Maine 04112