Forum Discussion
Bob_10976
May 12, 2008Nimbostratus
iRule re-write to replace ISAPI re-write
Hello all...
We are currently using ISAPI re-write in our portal to re-write uri's to the appropriate location. With the help of this forum I came up with the following, which work...
Oct 10, 2008
If you set the default pool on your virtual server to "pl_www_mycompany_com" then you will not have to specify it in the iRule. That is the preferred method unless there is some reason why you have another default pool setup.
Also, after a HTTP::redirect, you don't assign a pool as the redirect sends the 301 HTTP response right back to the client.
This should work for you:
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"www.mycompany.com" {
}
"mycompany.com" {
HTTP::redirect "http://www.mycompany.com[HTTP::uri]"
}
default {
reject
}
}
}
I threw in a "string tolower" since hostnames are case insensitive in most cases and your code would reject a request to "www.MyCompany.Com"
And feel free to thrown in the pool statement to the first "www.mycompany.com" case in case it isn't the default pool for your virtual server.
-Joe
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