Forum Discussion
How to set up http 301 response
- Feb 23, 2015
once you create a new virtual server for siteA, assign an iRule like:
when HTTP_REQUEST { HTTP::respond 301 Location "http://siteB.company.com" }
you could also do the same redirect using the same virtual server that you are using for siteB, assuming it's not HTTPS (certificate SANs would need to include siteA.company.com to avoid browser trust error), but the iRule would be:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "sitea.company.com"}{ HTTP::respond 301 Location "http://siteB.company.com" } }
if the URI structure is going to be the same between the two sites, I recommend tacking on [HTTP::uri] to the redirect so users don't have to re-navigate to the URL they originally requested:
HTTP::respond 301 Location "http://siteB.company.com[HTTP::uri]"
once you create a new virtual server for siteA, assign an iRule like:
when HTTP_REQUEST {
HTTP::respond 301 Location "http://siteB.company.com"
}
you could also do the same redirect using the same virtual server that you are using for siteB, assuming it's not HTTPS (certificate SANs would need to include siteA.company.com to avoid browser trust error), but the iRule would be:
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] equals "sitea.company.com"}{
HTTP::respond 301 Location "http://siteB.company.com"
}
}
if the URI structure is going to be the same between the two sites, I recommend tacking on [HTTP::uri] to the redirect so users don't have to re-navigate to the URL they originally requested:
HTTP::respond 301 Location "http://siteB.company.com[HTTP::uri]"
- Steven_Fulton_1Feb 23, 2015
Nimbostratus
Thanks so much shaggy. In the examples that I was looking at before, that was the part [HTTP::uri] that was confusing me. Thanks for explaining what that does.
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