I need a Irule which redirect to http://www.harish.com/ . Any one help us on this irule.
Whether or not you can actually do this will depend on what your user-agent (typically a browser) actually sends when you enter . Many user-agents will expand this by affixing a domain from the OS provided search order. If that happens, then the hostname that needs to be redirected is not , but rather something else.
Having said that, there are several ways to handle this. One way is to use an iRule, as you suggest:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "harish" } {
HTTP::redirect http://www.harish.com[HTTP::uri]
}
}
I assume here that you wish to maintain whatever request-URI was included in the original request. If you do not want that, you may simply omit the [HTTP::uri] part.
However, if you are using 11.4 or higher, you should consider using a Local Traffic Policy. It is likely faster, and in any case, does not require code:
If you are using a version before 11.4, you can use an HTTP Class to accomplish this:
Thanks Vernon..I got my answer from my superior..he said we can only redirect to/from fully qualified domain names. http://harish/ is not fully qualified,