One Redirect for all Rewrites

Topics: Rules, Setup
Nov 10, 2016 at 12:23 AM
Edited Nov 10, 2016 at 12:24 AM
I am wanting to know if its possible with Managed Fusion Rewriter to setup one redirect for all the rules.
ie if the incoming url is rewritten 1 or more times send a 301 redirect (probably "R=301") but if it hasn't been rewritten dont redirect

I have tried using a custom environment variable on each rule that does a rewrite and then check for the value of the variable at the end but it didn't seem to work. I am unsure if I did it wrong or Environment variables are not supported by URL Rewriter

Here is a snippet of my code:
#Here are some rules that set an environment variable
RewriteCond %{HTTP_HOST} !^mgbbackline\.com\.au$ [NC]
RewriteRule ^(.*)$$1 [E=REWRITE:done,NC]

RewriteRule ^/about-us.asp$  /about-us [E=REWRITE:done,NC]
RewriteRule ^/hire/([A-Za-z0-9-]+).asp/?$    /backline-hire/$1 [E=REWRITE:done,NC]
RewriteRule ^/instrument-hire/([A-Za-z0-9-]+)-hire/?$    /backline-hire/$1 [E=REWRITE:done,NC]

#Here is the check for the environment variable to redirect
RewriteCond %{ENV:REWRITE} done
RewriteRule .* $1 [L,R=301]
Please Help