Forum Discussion
Bob_10976
Jun 20, 2008Nimbostratus
A couple of examples from our rewrite rule is below, honestly I still don't completely understand it, my dev guy wrote these, I just put them in place, hope it helps a bit...
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/helpcenter/" } {
HTTP::uri "/helpcenter/Pages/default.aspx"
}
elseif { [string tolower [HTTP::uri]] equals "/helpcenter/livehelp.htm" } {
HTTP::uri "/Pages/livehelp.aspx"
}
elseif { [string tolower [HTTP::uri]] starts_with "/policy/privacy.htm" } {
HTTP::uri "/Pages/privacy.aspx"
}
elseif { [string tolower [HTTP::uri]] starts_with "/policy/security.htm" } {
HTTP::uri "/Pages/security.aspx"
}
}
Also is a few examples from our Redirect rule:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.mydomain.com" } {
HTTP::respond 301 Location http://mydomain.com[HTTP::uri]
}
elseif { ([string tolower [HTTP::uri]] equals "/default.htm") || ([string tolower [HTTP::uri]] equals "/default.html") } {
HTTP::redirect http://mydomain.com/
}
elseif { [string tolower [HTTP::uri]] starts_with "/newsroom" } {
HTTP::respond 301 Location http://test.mydomain.com/newsroom/[substr [HTTP::uri] 10 ]
}
elseif { [string tolower [HTTP::uri]] starts_with "/g2p" } {
HTTP::redirect http://test.mydomain.com/g2p/[substr [HTTP::uri] 5 ]
}
elseif { [string tolower [HTTP::uri]] starts_with "/eventcal" } {
HTTP::respond 301 Location http://test.mydomain.com/eventcal/[substr [HTTP::uri] 10 ]
Good luck..
Bob