Anish_Srivastav
Mar 02, 2010Nimbostratus
URL host rewrite based on URI
Hello guys
I was browsing through the forum and could not come across a similar situation that I am facing. We have a website with following links:
http://www.xyz.com/Product1
http://www.xyz.com/Product2
http://www.xyz.com/Product3
www.xyz.com is setup as a virtual server on the F5. Also, the above URL's have been indexed by various search engines. Now, we want to do the following:
If the request comes to http://www.xyz.com/Product1 then it should get redirected to http://Product1.xyz.com/Product1, now this is not that much of a problem as I can achieve this by setting a Host Header value Product1.xyz.com on the IIS webserver and an irule on the LTM such as:
when HTTP_REQUEST {
if {([HTTP::uri] starts_with "/Product1" and [HTTP::host] equals "www.xyz.com")}
{
HTTP::response 302 location "http://Product1.xyz.com[HTTP::uri]"
}
}
But, now from this page if the subsequent request is to /Product2, the link in the browser shows http://Product1.xyz.com/Product2. I would like the link in this case to be http://Product2.xyz.com/Product2 or in case of Product3 http://Product3.xyz.com/Product3
Is there any simpler way to achieve this rather than multiple if-else statements in the iRule as the Product line will keep on increasing in the future.
TIA
Anish