Man this stuff is hard.
I appreciate all the work that you have done here. Let me explain what I have done, and then maybe we can see how if, at all, it can be applied to your solution.
I tried to get this to work and had some significant problems getting it to work, all related to the rewrite rules.
I am sorry they were so complicated I could not understand them at all.
This is what I did.
I use the "all products" module, which creates one large list of all products for search engines to play with. Well it uses its own form of SEF urls, but from what I have been seeing they were not correct, and maybe yours were not correct either.
I also don't have my catalog at the top level of my site, I have it as /oscommerce/catalog, because I have other aspects of my site then just selling my wares.
Anyway I could not make heads nor tails of the Rewrite rules, they as the mod_rewrite author says are just like SendMail rules, and therefore are written in gibberish. BTW, I am an expert at regular expressions and it hurt my brain!!
Again I am only concerned with my allprods.php file generating urls that can be searched since it will place all of my products on it so it can further index them.
So I modified the code in allprods.php to write out the urls as follows:
XXX/oscommerce/catalog/product_info/products_id/38
This needs to be equivalent to
XXX/oscommerce/catalog/product_info.php?products_id=38
Notice that I forcibly dropped the .php; in my reading the .php is a no-no, and some including google may ignore that url since it is illegal.
Now again I could not make heads nor tails of the rewrite rules in .htaccess and that would not work for me.
So here is my replacement for the rewrite rules.
RewriteEngine on
RewriteBase /oscommerce/catalog
RewriteRule ^product_info/products_id/([0-9]+)$ product_info.php/products_id=$1
Here I specifically rewrite product_info/products_id/38 to
product_info.php?products_id=38
RewriteBase compensates for my positioning my catalog where I put it.
I do have the complicated part ([0-9+)$ that is much less complicated then what was before.
This works great for my specific purposes:
Here are my sources of information:
http://www.sitepoint.com/article/485
http://www.devarticles.com/art/1/506
I am sure we can formalize this if this if it is of interest to you all.
Sincerly
Julian