Forum Discussion
HTTP to HTTP 301 Redirect with URI
At present I have the following irule:
when HTTP_REQUEST {
if { [HTTP::host] equals "domain.co.uk"} {
HTTP::respond 301 Location "http://www.domain.co.uk/"
}
}
Which seems to work but redirects all matching traffic to the root of http://www.domain.co.uk/. What I need is an irule that brings the URI in the request into the 301 response.
So I wonder whether the following would work:
when HTTP_REQUEST {
if { [HTTP::host] equals "domain.co.uk"} {
HTTP::respond 301 Location "http://www.domain.co.uk[HTTP::uri]"
}
}
4 Replies
- Hamster_2020
Nimbostratus
Thanks a million for your quick response - I'll give rthat a whirl.
- nathe
Cirrocumulus
No probs, let us know if it works if you can
- Hamster_2020
Nimbostratus
I tried the suggestion and it didn't work - but the one I proposed worked just fine.
Thanks again.
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