Nov 9, 2009 at 12:19 PM
Edited Nov 9, 2009 at 12:20 PM
You have a URL that contains Category IDs and Product IDs, and you want to redirect to URLs that employ Category Names and Product Names, is that correct? In that case your rules will have to contain the mapping between IDs and NAMEs. Do you
understand that? You will need a different rule for each category, and for each product ID.
And you are sure you want a REDIRECT, and not a REWRITE, yes? Do you understand the difference between a REDIRECT and a REWRITE?
If you definitely want a REDIRECt, then I am surprised. I think it is more likely that you don't know what you are asking for.
If you want a redirect, then... here is how you would do it. Suppose Category ID 1755 corresponds to the category name "Hammers", and category 6213 corresponds to "Wrenches". And suppose, within Hammers, product ID 4115
refers to a Claw hammer, while 4116 refers to a Framing hammer. And within Wrenches, 5117 refers to a Box wrench and 5119 refers to an adjustable wrench. These rules would do the mapping.
# Map Category 6213 to Wrenches
RewriteRule ^/price/store/template/template3/Default.asp?mainPage=PRODUCT_INFO&cPath=6213&P_ID=([0-9]+) /price/Wrenches/$1
#Map Category 1755 to Hammers
RewriteRule ^/price/store/template/template3/Default.asp?mainPage=PRODUCT_INFO&cPath=6214&P_ID=([0-9]+) /price/Hammers/$1
# Map the product IDs to well-known names
RedirectRule ^/price/([^\]+)/4115 http://server/price/$1/Claw
RedirectRule ^/price/([^\]+)/4116 http://server/price/$1/Framing
RedirectRule ^/price/([^\]+)/5117 http://server/price/$1/Box
RedirectRule ^/price/([^\]+)/5119 http://server/price/$1/Adjustable
Notice that you need a single rule for each mapping of ID to name. The initial round of mappings will do the categories. These can be rewrites. The final round of mapping takes care of the products. This must be a redirect.
But, I don't think that makes sense. It will do what you described, but I have never seen anyone ask for that particular thing. I'm surprised that you are asking for this.