The http rewrite plug-in provides the means to rewrite/manipulate requests.
The following outlines the steps required to activate and configure the rewrite extension library to perform request manipulation.
In order to activate the http rewrite plug-in the httprewrite extension library must be loaded according to extension library configuration.
The rewrite module must be the last library to be loaded, thus that request manipulations of other modules are processed before the rewrite module is executed
Windows:
<EXTLIBS>
<LIB>C:\Programs\ics\bin\httprewrite.dll</LIB>
</EXTLIBS>
Unix:
<EXTLIBS>
<LIB>/usr/lib64/ics/libhttprewrite.so</LIB>
</EXTLIBS>
<EXTLIBS>
<LIB>/usr/lib32/ics/libhttprewrite.so</LIB>
</EXTLIBS>
The httprewrite configuration is introduced by the httpx:HTTPREWRITE tag, which can be child of the HOST or NODE tag.
<HOST>
<httpx:HTTPREWRITE>
<RULESET>
<COND>
<MATCH>
</MATCH>
</COND>
<REWRITE />
</RULESET>
</httpx:HTTPREWRITE>
</HOST>
The RULESET comprises a
Multiple RULESETs can be defined.
The httprewrite condition configuration is introduced by the COND tag, which can be child of the RULESET tag.
Multiple COND tags can be specified that are combined by an OR operation.
<HOST>
<httpx:HTTPREWRITE>
<RULESET>
<COND>
<MATCH VAR="REQUEST_FILENAME" OP="NOT" FUNC="DEXISTS" >
</MATCH>
</COND>
<COND>
<MATCH VAR="REQUEST_FILENAME" OP="NOT" FUNC="FEXISTS">
</MATCH>
</COND>
<REWRITE />
</RULESET>
</httpx:HTTPREWRITE>
</HOST>
The COND tag can have on or several MATCH tags which define the condition checks.
Mutliple MATCH tags can be specified and comprise an AND operation
The MATCH tag comprises the following attributes
The VAR attribute can specify one of the following variables:
The OP attribute can be one of the following operators
The FUNC attribute can be one of the following Functions
The STRING attribute contains a regular expression, which is applied to the content of the VAR variable.
The httprewrite rewrite configuration is introduced by the REWRITE tag and can be child of the RULESET tag.
Multiple REWRITE tags can be specified.
<HOST>
<httpx:HTTPREWRITE>
<RULESET>
<COND>
...
</COND>
<REWRITE REGEX="^(/horde/.*)$" REPLACE="/horde/rampage.php" PROCOPT="BREAK" />
</RULESET>
</httpx:HTTPREWRITE>
</HOST>
<httpx:HTTPREWRITE>
<RULESET>
<COND>
<MATCH VAR="REQUEST_FILENAME" OP="NOT" FUNC="FEXISTS" />
<MATCH STRING="^(/docu/iaeapps/.*/default-\S\S.html)$" OP="EQ" VAR="REQUEST_URL" />
</COND>
<!-- <COND>
<MATCH VAR="" OP="" WITH="" />
</COND> -->
<!-- <SET REQUEST="" TO="" />
<SET RESPONSE="" TO="" />
-->
<REWRITE REGEX="(/.*)\/.*(/.*)" REPLACE="\1\2" REDIRECT="302" />
</RULESET>
<RULESET>
<COND>
<MATCH VAR="REQUEST_FILENAME" OP="NOT" FUNC="FEXISTS" />
<MATCH STRING="^(/docu/iaeapps/.*)$" OP="EQ" VAR="REQUEST_URL" />
<MATCH STRING="^(/docu/iaeapps/.*/default-\S\S.html)$" OP="NOT" VAR="REQUEST_URL" />
<MATCH STRING="^(/docu/iaeapps/default-\S\S.html)$" OP="NOT" VAR="REQUEST_URL" />
</COND>
<!-- <COND>
<MATCH VAR="" OP="" WITH="" />
</COND> -->
<!-- <SET REQUEST="" TO="" />
<SET RESPONSE="" TO="" />
-->
<REWRITE REGEX="([^/]+)(-.*)$" REPLACE="default\2" />
</RULESET>
</httpx:HTTPREWRITE>
The REWRITE tag comprises three attributes
The REGEX attribute specifies the regular expression to apply to the URL
The REPLACE attribute specifies the replacement URL
The PROCOPT attribute specifies the processing option to be applied when the regular expression matches. The supported processing options are: