Old to New External URL Rewrite



The Citrix NetScaler can be placed in front of a webserver farm that is running Apache. The same re-write rules that run on Apache, can be implemented on the Citrix NetScaler.

Assume that you have recently renamed the page foo.html to bar.html and now want to provide the old URL for backward compatibility. But this time you want the users of the old URL to see new one, i.e. their browsers Location field should change too.

Example : The following rules can force an HTTP redirect to the new URL which leads to a change of the URL in the users browser:

Apache rewrite:

RewriteEngine  on
RewriteBase    /~quux/
RewriteRule    ^foo\.html$  bar.html  [R]



AppExpert rewrite: (There are two ways to do this)

“Solution 1”
add responder action act1 redirect 'HTTP.REQ.URL.BEFORE_STR(<span class="code-quote">"foo.html"</span>)+<span class="code-quote">"bar.html"</span>' -bypassSafetyCheck yes

add responder policy pol1 'HTTP.REQ.URL.ENDSWITH(<span class="code-quote">"/~quux/foo.html"</span>)' act1

bind responder global pol1 100
“Solution 2”
add responder action act1 redirect 'HTTP.REQ.URL.PATH.BEFORE_STR(<span class="code-quote">"foo.html"</span>)+<span class="code-quote">"bar.html"</span>+HTTP.REQ.URL.AFTER_STR(<span class="code-quote">"foo.html"</span>)' -bypassSafetyCheck yes

add responder policy pol1 'HTTP.REQ.URL.PATH.CONTAINS(<span class="code-quote">"foo.html"</span>)' act1

bind responder global pol1 100



Tap into the power of AppExpert!