Forum Discussion
Kai_Wilke
Jan 26, 2016MVP
Hi Ram,
you may take a look to the two example below.
Example1: Redirect just "/" (aka. Website ROOT) to /xyz/
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "abc.com" } then {
if { [string tolower [HTTP::uri]] equals "/" } then {
Redirect just "/" (aka. Website ROOT) to /xyz/
HTTP::redirect "https://abc.com/xyz/"
} else {
You may want to implement additional code to handle request to other URIs.
}
} else {
You may want to implement additional code to handle request to other HOST-names.
}
}
Example2: Redirect everthing which is not /xyz to /xyz/
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "abc.com" } then {
if { [string tolower [HTTP::uri]] starts_with "/xyz" } then {
You may want to implement additional code to handle /xyz requests.
} else {
Redirect everthing which is not /xyz to /xyz/
HTTP::redirect "https://abc.com/xyz/"
}
} else {
You may want to implement additional code to handle request to other HOST-names.
}
}
Cheers, Kai