You need to turn complex content management system, blog, or shopping cart URLs into easy-to-remember URLs.
mod_rewrite rules in an
.htaccess file to invisibly turn simple URLs into
complex query strings that return dynamic pages to the visitor's
browser. For example, an e-commerce site that sells men and women's
clothes might offer a variety of men's shoes, such as boots, oxfords,
sandals, and loafers.
A URL for the list of loafers might look like this:
Using rewrite rules, you can tidy up the URL to something like this:
A rewrite rule in the .htaccess file that you create or modify in the /store directory takes care of converting the clean URL to the more complex query string that the store template (list.php) needs to generate the list of loafers from the store database. Here's the code for the rewrite rule:
RewriteEngine On Options +FollowSymLinks RewriteRule ^(.*)/(.*)/(.*)/$ /store/list.php?type=$1&cat=$2&subcat=$3
module has been compiled into your installation of Apache (typically,
it has), the first line (
On) prepares the module for the rewrite rule or rules to
follow. The second line (
+FollowSymLinks) can be left out if it's already in the main
Apache configuration file (typically,
The third line contains the rule. Three ...