Create a more efficient Rule for my Querystrings - Help!

Topics: Developer Forum, Project Management Forum, User Forum
Feb 26, 2014 at 5:39 PM
Edited Feb 26, 2014 at 5:41 PM
Below is a code-snippet from my current script that writes to the IIRF.ini file when I run it.

I think there must be a more efficient method to create a rule to process the querystrings on the fly, so I don't have to write 5 lines of rules for every product I have. So, if I end up with 100 products, that would result in 500 lines of rules. Not real good in my opinion. I need speed, not bloat.

Here's a piece of my current script that writes to my INI file
If Not oRS.EOF Then
Do While not oRS.eof

    pName=oRS("pName")
    pName=LCase(pName)
    pURL=Replace(pName," ",urlfillerchar) + ".asp"
    oFile.write "RedirectRule ^/proddetail\.asp\?prod=" & oRS("pID") & "$" & " /" & pURL & " [R=301]" & vbcrlf
    oFile.write "RewriteRule ^/" & pURL & "$" & " /proddetail.asp?prod=" & oRS("pID") & " [L]" & vbcrlf
    oFile.write "RewriteRule ^/" & pURL & "\?review=true" & "$" & " /proddetail.asp?prod=" & oRS("pID") & "&review=true [L]" & vbcrlf
    oFile.write "RewriteRule ^/" & pURL & "\?review=all" & "$" & " /proddetail.asp?prod=" & oRS("pID") & "&review=all [L]" & vbcrlf
    oFile.write "RewriteRule ^/" & pURL & "\?review=all&ro=1" & "$" & " /proddetail.asp?prod=" & oRS("pID") & "&review=all&ro=1 [L]" & vbcrlf
    oFile.write "RewriteRule ^/" & pURL & "\?review=all&ro=2" & "$" & " /proddetail.asp?prod=" & oRS("pID") & "&review=all&ro=2 [L]" & vbcrlf
    oFile.write "RewriteRule ^/" & pURL & "\?review=all&ro=3" & "$" & " /proddetail.asp?prod=" & oRS("pID") & "&review=all&ro=3 [L]" & vbcrlf

oRS.movenext
Loop
Here are the resulting written rules (per product) in my INI: (which work just fine)
RedirectRule ^/proddetail\.asp\?prod=bwidget$ /blue-widget.asp [R=301]
RewriteRule ^/blue-widget.asp$ /proddetail.asp?prod=bwidget [L]
RewriteRule ^/blue-widget.asp\?review=true$ /proddetail.asp?prod=bwidget&review=true [L]
RewriteRule ^/blue-widget.asp\?review=all$ /proddetail.asp?prod=bwidget&review=all [L]
RewriteRule ^/blue-widget.asp\?review=all&ro=1$ /proddetail.asp?prod=bwidget&review=all&ro=1 [L]
RewriteRule ^/blue-widget.asp\?review=all&ro=2$ /proddetail.asp?prod=bwidget&review=all&ro=2 [L]
RewriteRule ^/blue-widget.asp\?review=all&ro=3$ /proddetail.asp?prod=bwidget&review=all&ro=3 [L]