Forum Discussion
Thiyagu_343098
Nimbostratus
May 24, 2018URL redirect with 301 from old host name to new host name for many URLs
Hello All,
I'm working on task for an URL redirection from the old host to the new host for many URLs.
for example any URL of *.test.com should get redirected to *.result.com.
Regards,
Thiy...
Samir_Jha_52506
Noctilucent
May 25, 2018You could use getfield function to grep host name.
iRule will be some thing like below. Paste the comments if any help require.
when HTTP_REQUEST {
if { [HTTP::host] contains "test.com"} {
HTTP::respond 301 Location "https://[getfield [HTTP::host] ".test.com" 1].result.com[HTTP::uri]
}
}
Cheers...
Samir_Jha_52506
Noctilucent
May 29, 2018See below(comma is missing at end)
when HTTP_REQUEST {
if { [HTTP::host] contains "test.com"} {
HTTP::respond 301 Location "https://[getfield [HTTP::host] ".test.com" 1].result.com[HTTP::uri]"
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
