[thelist] Apache mod_rewrite

Rob Smith rob.smith at THERMON.com
Wed Feb 23 12:03:38 CST 2005


>RewriteRule ^/Product(.*) http://www.mydomain.com/products.cgi?$1 [NC,R,L]

Fascinating!

So for example,

RewriteRule ^/(.*) http://www.mydomain.com/products.php?$1
where (.*) = $1 = arguement 1?

Then I could take $1 as the querystring and run that value against a known
list of products and display that material?

The NC stands for no case, i.e., there is no difference between 'A-Z' and
'a-z' when Pattern is matched against the current URL. Furthermore, if
someone where to input http://www.mydomain.com/XyZ it would redirect, and
assuming your cgi/php page is set up correctly, try to match that argument
against xyz, xyZ, xYz, xYZ, Xyz, XyZ, XYz, and XYZ.
The R stands for force Redirect
The L stands for Last redirect rule, ignore anything else. I suppose from
experience this is a good arguement to supply the RewriteRule command.

Rob


More information about the thelist mailing list