Remove Beginning Section of URL Using Rewrite Policy

Remove Beginning Section of URL Using Rewrite Policy

book

Article ID: CTX221363

calendar_today

Updated On:

Description

Customer is looking for a way to remove a specific section of a URL at the beginning of the path


Instructions

Configure a Rewrite Action such as this:
add rewrite action test replace HTTP.REQ.URL "\"/\"+HTTP.REQ.URL.PATH_AND_QUERY.STRIP_START_CHARS(\"/start_of_path/\")" -bypassSafetyCheck YES

Here the string at the start of the Path of the URL will be removed, regardless of the rest of the URL.
e.g: hostname.domain.local/start_of_path/end_of_path will be rewritten as hostname.domain.local/end_of_path

You need will need to specify the extra / at the beginning of the action to compensate for the STRIP_START_CHARS

Additional Information

STRIP_START_CHARS(s) strips matching characters from the beginning of the input string until the first non-matching character is found and returns the remainder of the string. For example, for expression: HTTP.REQ.URL.PATH_AND_QUERY.STRIP_START_CHARS("/racs") if the PATH AND QUERY are this: "/rasc/arc/cars/test"; result will be just "test"

http://discussions.citrix.com/topic/349006-delete-a-portion-of-a-path-rewite/