Forum Moderators: phranque
http://www.example.com/purchase/inventory/product/123456 --> http://www.example.com/purchase/product-line/details/category/123456
RewriteMap product_SKUs dbm:/etc/httpd/conf.d/maps/product_SKUs.dbm
/etc/httpd/conf.d/maps/product_SKUs.dbm.pag
/etc/httpd/conf.d/maps/product_SKUs.dbm.dir
RewriteCond %{REQUEST_URI} ^/purchase/inventory/product/${product_SKUs:$1}
RewriteRule ^.* http://www.example.com/purchase/product-line/details/category/${product_SKUs:$1} [R=301,L]
${product_SKUs:$1}
RewriteCond %{REQUEST_URI} ^/purchase/inventory/product/${product_SKUs:$1}
RewriteRule ^.* http://www.example.com/purchase/product-line/details/category/${product_SKUs:$1} [R=301,L] RewriteCond %{REQUEST_URI} ^/purchase/inventory/product/${product_SKUs:$1}
RewriteRule ^purchase/inventory/product/ http://www.example.com/purchase/product-line/details/category/${product_SKUs:$1} [R=301,L] /purchase/inventory/product/(.+) I'm having trouble finding anything in the docs that say I can use rewritemap values inside a condition
I only want the rule to match on product SKUs in that list. If I tell it to rewrite on every hit then I'll be directing traffic to a backend where the products don't exist, right?
RewriteCond ${product_SKUs:%{REQUEST_URI}} (.+) I can't find a way to have it use data from the line itself for the first part of the URI then the rewritemap value for the last part.
<snip>
RewriteCond ${product_SKUs:%{REQUEST_URI}} (.+)
RewriteCond %{REQUEST_URI} /purchase/inventory/product/(\d+)
RewriteCond ${product_SKUs:%1} (..+)
RewriteRule ^purchase/inventory/product/ http://www.example.com/purchase/product-line/details/category/%1 [R=301,L]
RewriteCond %{REQUEST_URI} /trythis/(\d+)
RewriteCond %1 (\d\d)
RewriteRule trythis http://www.example.com/%1.html [R=301,L]
RewriteCond ${product_SKUs:%1} (..+) RewriteCond ${product_SKUs:$1} (..+)
RewriteRule ^purchase/inventory/product/(.+) http://www.example.com/purchase/product-line/details/category/%1 [R=301,L]