Forum Discussion
URI Handling for Redirection
I have a situation where I need to modify a simple redirect to ideally, include the URI afterwards, but the URI is unknown at the moment. The situation is that I have to compensate for some poorly written code. The code references both the root and www domain. So the URI information is being stripped with the basic redirect as shown below:
when HTTP_REQUEST {
if {[HTTP::host] contains "mydomain.com"} {
HTTP::redirect www.mydomain.com}
}
Is there a way to modify this redirect to include the URI information afterwards and include in the redirection?
For example:
Request comes in for "mydomain.com/doc/?=345673"
I need to redirect it to www.mydomain.com/doc/?=345673
1 Reply
- What_Lies_Bene1
Cirrostratus
There is;when HTTP_REQUEST { if { [string tolower [HTTP::host]] contains "mydomain.com" } { HTTP::redirect "www.mydomain.com[HTTP::uri]" } }
I've added the string tolower command to avoid any Case issues.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com