Hi Shafiul,
I've included
/somecontent/
in my example, because you've asked for this...
😉
Your modified version should include at least an additional exemption for the
/
(www-root) of your site. Otherwise a redirect loop may occour...
when HTTP_REQUEST {
if { ( [HTTP::path] ends_with "/" ) and not ( [HTTP::path] equals "/" ) } then {
if { [HTTP::query] eq "" } then {
HTTP::respond 301 "Location" "https://[getfield [HTTP::host] ":" 1][string range [HTTP::path] 0 end-1]"
} else {
HTTP::respond 301 "Location" "https://[getfield [HTTP::host] ":" 1][string range [HTTP::path] 0 end-1]?[HTTP::query]"
}
} else {
Request to other base directory or a path without trailing / detected
}
}
Cheers, Kai