Forum Discussion
Redirect to marketing site without impacting other url/pools
I have a redirect problem that is a bit difficult for me to solve. Most of our sites/pools require a suffix after the main domain.
For example:
www.example.com/production
www.example.com/sales
www.example.com/marketing
etc...
We have the default pool set to www.example.com/production. Thus, if a user types in only www.example.com with no suffix they will be sent to the production pool.
Instead, the company wants to redirect to a marketing site when no suffix is listed. The irule below
shows a redirect that is a good start. However, how do I make it work without a specific path without causing problems for the rest of the environments? Do I simply take out the path section? Will that break the rest of the redirects since the domain name is in all of them?
Original
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "www.example.com" and [HTTP::path] eq "/path1/abc" } {
HTTP::respond 301 Location "http://www.marketingsite.com"
}
}
No path
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "www.example.com" } {
HTTP::respond 301 Location "http://www.marketingsite.com/"
}
}
Hi Chris,
You should add below line for no path. Otherwise when host is www.example.com, it always redirects.
[HTTP::path] eq "/"
when HTTP_REQUEST { if { [string tolower [HTTP::host]] eq "www.example.com" and [HTTP::path] eq "/"} { # ... } }
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