First off this is doing the job that I want it to. Namely, user enters: --) mydomain.com/stuff/cat/tech/linux and it becomes the equivalent of --) mydomain.com/stuff/news.php?cat=tech&sub_cat=linux My .htaccess is located in the sub-directory "stuff" <IfModule mod_rewrite.c> RewriteEngine on RewriteRule cat/(.*)/(.*)$ news.php?cat=$1&sub_cat=$2 </IfModule> Code (markup): Tested, works, can't find a problem. However being the paranoid programmer type... cat/(.*)/(.*)$ Finally the question: Since I am not starting with a ^, are there considerations and/or unintended consequences with this? I guess that the exp will match any string ending with "cat/anything/anything" and how could it start with anything except "mydomain.com/stuff/" since the .htaccess is located there? Is there some best practice I am missing? There isn't enough coffee in my bloodstream, so I hope this made sense. TIA
have alook here http://forums.digitalpoint.com/showthread.php?t=23044 (.*) allows all characters, as you want to tighten control you may wish to use ([0-9]+) at least one character but numbers only or ([A-Z]+) capital characters only and so on... Expat
Thanks for the link and info. I tried numerous variations, but ended up almost back where I started from. I kept getting 500's when I tried [NC] and a-z rather than a-zA-Z, but no big deal. <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^cat/([a-zA-Z]+)/([a-zA-Z]*)$ news.php?cat=$1&sub_cat=$2 [L] </IfModule> Code (markup): It is more exacting, so I am happier. I also see now how I can extend it to do some other things!
cheers there is an exaustive one on WMW as well http://www.webmasterworld.com/forum92/4332.htm So if you want to indulge in mod_rewrite have fun Expat