Citrix Systems Network Router 9.2 User Manual

Page of 302
 Appendix  E        Migration of Apache mod_rewrite Rules to Advanced Policies
261
NetScaler solution for enforcing a particular host name for sites running on 
a port other than 80 
add responder action act1 redirect '"http://
www.example.com:"+CLIENT.TCP.DSTPORT+HTTP.REQ.URL' 
-bypassSafetyCheck yes
add responder policy pol1 
'!HTTP.REQ.HOSTNAME.CONTAINS("www.example.com")&&!HTTP.REQ.HOSTNAME
.EQ("")&&!HTTP.REQ.HOSTNAME.PORT.EQ(80)&&HTTP.REQ.HOSTNAME.CONTAINS
("example.com")' act1
bind responder global pol1 100 END
NetScaler solution for enforcing a particular host name for sites running on 
port 80 
add responder action act1 redirect '"http://
www.example.com"+HTTP.REQ.URL' -bypassSafetyCheck yes
add responder policy pol1  
'!HTTP.REQ.HOSTNAME.CONTAINS("www.example.com")&&!HTTP.REQ.HOSTNAME
.EQ("")&&HTTP.REQ.HOSTNAME.PORT.EQ(80)&&HTTP.REQ.HOSTNAME.CONTAINS(
"example.com")' act1
bind responder global  pol1 100 END
Moving a Document Root
Usually the document root of a Web server is based on the URL “/”. However, the 
document root can be any directory. You can redirect traffic to the document root 
if it changes from the top-level “/” directory to another directory.
In the following examples, you change the document root from / to /e/www. The 
first two examples simply replace one string with another. The third example is 
more universal because, along with replacing the root directory, it preserves the 
rest of the URL (the path and query string), for example, redirecting /example/
file.html to /e/www/example/file.html. 
Apache mod_rewrite solution for moving the document root
RewriteEngine on
RewriteRule   ^/$  /e/www/  [R]
NetScaler solution for moving the document root
add responder action act1 redirect '"/e/www/"' -bypassSafetyCheck 
yes
add responder policy pol1 'HTTP.REQ.URL.EQ("/")' act1
bind responder global pol1 100