Recently I have been researching the latest SEO techniques to make sure I was following best practices when building applications for my clients that could benefit from SEO. A big component of SEO stresses the importance of search engine safe (SES) urls.
In a nutshell, SES urls present the URL string in a format that is considered "clean" to both human and search engine bots that index your pages. It is widely believed that Google does not deeply index dynamic URLs using the standard query string format like this;
The above example is not considered a SES url due to its cryptic nature.
A SES url for this link could be written as:
It is easy to see that the SES formatted URL is more information rich than the URL written using the standard query string.
First let me say that there are other ways to create SES URLs. However, I use Apache for nearly all of my applications so this example will be based on the Apache mod_rewrite plugin. Secondly, I am still cutting my teeth on regular expressions that go beyond the very basic, so there may very well be more elegant ways to accomplish the same tasks.
To turn ON mod_rewrite uncomment this line in your httpd.conf file:
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so
Mod_rewrite directives can be placed in your .htacess file for the site or they can be placed in the vhost site definition. I choose to manage mod_rewrite rules using the vhosts config.
Here are the mod_rewrite directives in the vhost config for this site. The file is commented out to explain what each directive does.
Essentially this setup will rewrite SES urls from this:
From this we can get the cgi.QUERY_STRING and parse out the variables to control page behaviors.