Man! For not having access to a BIG-IP, you were almost dead on. I modified it slightly and this is what I came up with:
when HTTP_REQUEST {
if { [HTTP::uri] contains ".php" } {
HTTP::redirect http://[HTTP::host][string map -nocase {".php" ".html"} [HTTP::uri]]
}
}
You should download a copy of LTM VE (http://tinyurl.com/f5ltmve). It is free and runs on VMWare ESXi, Workstation, or Player. I use it extensively for testing iRule code and configurations involving LTM. Hope this helps,
As George suggests, LTM VE would be a great way to test this.
Do you want the user to see the change to the file type? If so, then a redirect would work fine. If you want the change to be transparent to the user, you could change the redirect to a rewrite:
when HTTP_REQUEST {
if { [HTTP::path] ends_with ".php" } {
HTTP::uri [string map -nocase {".php" ".html"} [HTTP::path]]
}
}