Hi again :) I've got a rule that rewrites any calls to /assets/xxxx (where 'xxxx' is the asset type, like Cars, Trucks, Buses etc.) to a script that takes the asset name and does a lookup for the ID of that specific asset type and then does a response.redirect
to /search/newsearch.asp?catid=n (where 'n' is the asset type ID. The rule looks like this:
RewriteRule /assets/(.*)$ /search/Switcher.asp?A=$1
This part works perfectly. However, I would like to be able to rewrite the resulting redirect so that the browser address bar shows http://www.mysite.com/assets/Cars rather than http://www.mysite.com/search/newsearch.asp?cat_id=8. To that end I created another
rule to try and achieve this (this second rule is not yet working):
RewriteRule /Search/NewSearch.asp?cat_id=.*$ /assets/Cars
And I'd also like to avoid having to run another script to do the reverse lookup of the name from the ID again, because it seems like then I'll be stuck in an infinite loop of forward and reverse lookups.
My question is therefore this: is there a way for me to "save" the initial backreference from my first rule match, and use it in my second rule match so that I can use it to rewrite the redirect rule? Will IIRF even rewrite a redirect prior to
it being served? I'd just like to know if I'm barking up the wrong tree so as not to spend too much time on this.
Thanks in advance!