Hi Ashish,
you may try the iRule below as a startingpoint to replace your existing mod_rewrite functionality.
The iRule will rewrite a client side request of...
http(s)://www.domain.tld/path1/path2?query=1
... to a server side request of ...
http(s)://www.domain.tld/content/obi/path1/en/path2.html?query=1
... or ...
http(s)://www.domain.tld/path1/path2/path3
... to ...
http(s)://www.domain.tld/content/obi/path1/en/path2/path3.html
iRule:
when HTTP_REQUEST {
Replacement for QSA option
if { [HTTP::query] ne "" } then {
set input_query "?[HTTP::query]"
} else {
set input_query ""
}
Replacement for RewriteRule
set root_folder [substr [HTTP::path] 1 "/"]
set remaining_path [string range [HTTP::path] [expr { [string length $root_folder]+2 }] end]
HTTP::uri "/content/obi/${root_folder}/en/${remaining_path}.html${input_query}"
}
Note: You may also post any previous RewriteRules to see if certain URIs requiring exemptions for the given rewrite.
Note: To assist you with the PT
option, its required to know your existing aliases (if configured).
Note: The L
option is already implied within PT
and doesn't require special attention within iRules.
Cheers, Kai