I'm very new in terms of writing rules for ISAPI Rewrite 3 from Helicon (licensed version) to be used for IIS6. I need to write 90+ rules for different pages from "subdomain.domain.com" to "www.domain.com", and I'm not very familiar with RegEx patterns. Unfortunately, these sites don't mirror, so doing a simple query string append won't work.
Example: Redirect "http://subdomain.domain.com/products/product.aspx?id=42" to "http://www.domain.com/productgroup/productinfo"
I have a pretty good start on it, however the furthest I've gotten is to get a specific page redirect to work. I need to get it down to the specific ID for some of these pages to redirect differently. Currently, the code I have for the web page redirect to Google (just for testing purposes) is
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.102
RewriteEngine on
RewriteRule ^(subfolder.html)/?(.*)$ http://www.google.com/ [NC,R=301,L]
NOTE: I just created a simple website with the following pages: - /index.html - /subfolder/subfolder.html - /subfolder/subfolder2.html - /subdir/subdir.html
According to the previous code, "/subfolder/subfolder.html" redirects to Google and the others show the page normally. For testing purposes, I've been trying to append "id=1" to redirect to YouTube and "id=2" to redirect to Facebook, and neither of those are working at the moment. The code for that is
RewriteRule ^(subfolder2.html\?id=1)$ http://www.youtube.com/ [NC,R=301,L]
RewriteRule ^(subfolder2.html\?id=2)$ http://www.facebook.com/ [NC,R=301,L]
All I need is to get a pattern that works, then I can modify it from there to make it work for the rest of the pages.
Thank you for any responses!
After a lot of trial and error, this is how I ended up getting it to work.
From my understanding of it the "RewriteCond" looks for that ID (in this case). The RewriteRule consists of the original URL without the query string (products/product_detail.aspx) and the redirected URL (http://www.newdomain.com/NewProductPage).