Usually we all get very greedy while making our url structure using .htaccess
For example, This will not work as you think
RewriteRule ^(.*)/$ category/categories.php?cat=$1 [L,QSA]
RewriteRule ^(.*)/(.*)/$ category/categories.php?cat=$1&name=$2 [L,QSA]
This will not work as after first rewrite will write , the current url structure will change to www.mydomain.com/<something>, Which will result to the last rewrite rule to be implemented after current url structure , i.e www.mydomain.com/<something>/ , Which is different from origianl structure www.mydomain.com. This can also result in loss of images as they are on relative path
RewriteRule ^([^/]+)/$ category/categories.php?region=$1 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/$ category/categories.php?cat=$1&name=$2 [L,QSA]
My two cents
{ 2 comments… read them below or Shout @ me! }
Isn’t it better to use “RewriteRule ^(.*)$ controller.php?route=$1 [L,QSA]“, and then parse this $1 (which could look like “/category/7″) in index.php, MVC-style? Cleaner design, *and* better SEO.
At least, it’s how I tend to do it.
Uhm, s/index.php/controller.php/
{ 1 trackback }