Tools for SEO: Search Engine Friendly URLs - Mod_Rewrite
(Page 3 of 4 )
Most search engines, especially all major ones, will not index pages with query strings because it may also indicate that the content of the page is not static and it prevents spamming to some extent. There's multiple ways to disguise the query string though. The easiest and probably most used involves mod_rewrite on Apache servers.
If your server is hosted on a Linux or Unix (*nix) server, then you may have access to Apache’s module called mod_rewrite. This is a nifty module indeed. What it does is return to the browser a URL that appears to be the actual web address of the page, when in fact the URL itself is not being changed in any way. It’s more of a mirror effect.
When a request comes in to a server for the new static URL through mod_rewrite, the Apache module redirects the URL internally to the old, dynamic URL, while still appearing to all the world, search engines included, as the static URL. The web server compares the URL requested by the client with the search pattern in the individual rules. For example, when someone requests the SEF URL:
http://www.somesite.com/index-forumid/120957w/0404200620%
search.htm
The server looks for and compares this static-looking URL to what information is listed in the .htaccess file, such as:
Options +FollowSymLinks RewriteEngine on RewriteRule index-forumid (.*)/(.*)/(.*).htm$ index.php?forumid=$1&=$2&=$3 |
So what if you are on a Microsoft IIS server? Well, there is another way to accomplish this using code, but it’s far more painful to use than mod_rewrite. But it can certainly be done. Unfortunately for the time being, that is outside the scope of this article.
301 vs. 302 Redirects
Redirects can either be good or bad as far as SEF URLs are concerned. 302 redirects are temporary redirects. These tell a search engine spider that you’ve moved this page only temporarily and to index it later when you have moved it to a new home for good. While this may not be what you actually had in mind to do, that’s how a search engine reads a 302 redirect. Use instead a 301 permanent redirect. It’s the 301 redirect that informs the search engine of the new URL and to start indexing it instead of the old URL. 301 redirects are also fairly seamless, so your visitors will also probably not be aware of the move, and if they’ve bookmarked a particular page, this will be especially helpful.
Next: Tools on the Web >>
More Search Optimization Articles
More By Jennifer Sullivan Cassidy