Forum Moderators: phranque
/ --> http://www.example.com/us/en/main.html
/?ps=1 --> http://www.example.com/us/en/main.html
/browse.cfm?prdID=99ABCDE-88FG-77HI--66JKLMNOP --> http://www.example.com/shop/catalog/item/12345
/pdfs/iteam-A.pdf --> http://www.example.com/shop/catalog/item/112233
/Products/View.cfm?cat=ItemClass&ID=0123ABC --> http://www.example.com/us/en/main/category1/subcategory1/productDetail.html
/previews/?d=7788 --> http://www.example.com/us/en/main/category1/subcategory2/productDetail.html
/Products/Search.cfm?prdID=88900ABCDEF-77GH-66IJ-55KLMNOP --> http://www.example.com/us/en/main/category1/subcategory2/productDetail.html
RewriteEngine on
RewriteMap rdm txt:/apps/httpd-2.4.10/conf/extra/redirects/rdm.txt
#Base URL contains a query string
RewriteCond %{HTTP_HOST} ^.*test.com
RewriteCond %{REQUEST_URI} ^/(b|B)rowse.cfm$
RewriteCond %{rdm:%1?%{QUERY_STRING}} ^(.*\?.*)$
RewriteRule ^.*$ %1 [R=301,L]
#Base URL does not contain query string
RewriteCond %{HTTP_HOST} ^.*test.com
RewriteRule ^.*$ ${rdm:$1} [R=301,L]
RewriteRule ^.*$ %1 [R=301,L]
RewriteCond %{HTTP_HOST} ^.*test.com
RewriteCond %{REQUEST_URI} ^/(b|B)rowse.cfm$
RewriteCond %{rdm:%1?%{QUERY_STRING}} ^(.*\?.*)$
RewriteRule ^.*$ %1 [R=301,L]
RewriteRule /(b|B)rowse\.cfm$ http://www.example.com/ {etcetera} [R=301,L] #Base URL does not contain query string
RewriteCond %{QUERY_STRING} !. RewriteRule ^.*$ %1? [R=301,L] I have no way to avoid every single request being matched against the rules
RewriteEngine on
RewriteMap rdm txt:/apps/httpd-2.4.10/conf/extra/redirects/redirect_map.txt
#Base URL contains a query string
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{REQUEST_URI} !=""
RewriteCond ${rdm:%{REQUEST_URI}?%{QUERY_STRING}|NOT_FOUND} !=NOT_FOUND
RewriteRule ^.*$ ${rdm:%{REQUEST_URI}?%{QUERY_STRING}}? [R=301,L]
#Base URL does not contain query string
RewriteCond %{QUERY_STRING} !.
RewriteCond %{REQUEST_URI} ^(.*)
RewriteRule ^.*$ ${rdm:%1} [R=301,L]
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{REQUEST_URI} !=""
RewriteCond ${rdm:%{REQUEST_URI}?%{QUERY_STRING}|NOT_FOUND} !=NOT_FOUND
RewriteRule ^.*$ ${rdm:%{REQUEST_URI}?%{QUERY_STRING}}? [R=301,L]
RewriteCond %{QUERY_STRING} !.
RewriteCond %{REQUEST_URI} ^(.*)
RewriteRule ^.*$ ${rdm:%1} [R=301,L]
RewriteCond %{QUERY_STRING} .
RewriteCond %{REQUEST_URI} . RewriteRule ^.*$ etcetera
RewriteRule .? etcetera RewriteRule ^ etcetera thanks a lot for all the advice you provide