Appendix E

Migration of Apache mod_rewrite Rules to Advanced Policies

265

Redirecting to a New File Name (Invisible to the User)

If you rename a Web page, you can continue to support the old URL for backward compatibility while preventing users from recognizing that the page was renamed.

In the first two of the following examples, the base directory is /~quux/. The third example accommodates any base directory and the presence of query strings in the URL.

Apache mod_rewrite solution for managing a file name change in a fixed location

RewriteEngine on

RewriteBase /~quux/

RewriteRule ^foo\.html$ bar.html

NetScaler solution for managing a file name change in a fixed location

add rewrite action act1 replace 'HTTP.REQ.URL.AFTER_STR("/ ~quux").SUBSTR("foo.html")' '"bar.html"'

add rewrite policy pol1 'HTTP.REQ.URL.ENDSWITH("/~quux/foo.html")' act1

bind rewrite global pol1 100

NetScaler solution for managing a file name change regardless of the base directory or query strings in the URL

add rewrite action act1 replace 'HTTP.REQ.URL.PATH.SUFFIX(\'/\',0)' '"bar.html"'

Add rewrite policy pol1 'HTTP.REQ.URL.PATH.CONTAINS("foo.html")' act1

Bind rewrite global pol1 100

Redirecting to New File Name (User-Visible URL)

If you rename a Web page, you may want to continue to support the old URL for backward compatibility and allow users to see that the page was renamed by changing the URL that is displayed in the browser.

In the first two of the following examples, redirection occurs when the base directory is /~quux/. The third example accommodates any base directory and the presence of query strings in the URL.

Page 279
Image 279
Citrix Systems 9.2 Redirecting to a New File Name Invisible to the User, Redirecting to New File Name User-Visible URL