Example 7: Marketing keyword redirection
The marketing department at Example Inc. wants to set up simplified URLs for certain predefined keyword searches on the company’s Web site. For these keywords, it wants to redefine the URL as shown below.
-
External URL:
http://www.example.com/\<marketingkeyword\>
-
Internal URL:
http://www.example.com/go/kwsearch.asp?keyword=\<marketingkeyword\>
To set up redirection for marketing keywords, you would create a rewrite action with the values in the following table.
| Action Name | Type of Rewrite Action | Expression to choose target location | String expression for replacement text |
|---|---|---|---|
| Action-Rewrite-Modify_URL | INSERT_BEFORE | HTTP.REQ.URL.PATH.GET(1) | ""go/kwsearch.aspkeyword="l" |
You would then create a rewrite policy with the values in the following table.
| Policy Name | Action Name | Undefined Action | Expression |
|---|---|---|---|
| Policy-Rewrite-Modify_URL | Action-Rewrite-Modify_URL | NOREWRITE | HTTP.REQ.HOSTNAME.SERVER.EQ("www.example.com") |
Finally, you would bind the rewrite policy, assigning it a priority of 800. Unlike the previous rewrite policies, this policy should be the last to be applied to a request that matches its criteria. For this reason, NetScaler administrator sets its Goto Priority Expression to END.
Any request using a marketing keyword is redirected to the keyword search CGI page, whereupon a search is performed and all remaining policies are skipped.