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...
Thiyagu_343098
Nimbostratus
May 29, 2018Hello All, I have tried the below script and it is throwing the error while saving the irule. Could you please help me to know anything syntax I have to change with the below script?
when HTTP_REQUEST { if { [HTTP::host] contains "test.com"} { HTTP::respond 301 Location "https://[getfield [HTTP::host] ".test.com" 1].result.com[HTTP::uri] } }
Your quick help would be appreciable.
Regards, Thiyagu
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
