AndyCooney_1337
May 22, 2011Nimbostratus
rewrite .com to .org for any domain
We host many of our sites as .org but still register the .com and .net domains. We'd like to have a single VIP that takes any "requested_domain.com" and rewrites it to "requested_domain.org". Currently we use a rule that I found on this site by Denny Payne:
when HTTP_REQUEST {
if { [HTTP::host] contains "mysite.com" }
{ HTTP:: redirect http://www.mysite.org }
}
This works great however every time we add another domain we have to modify the iRule. I'd like to create one that works on any request.
If it were to turn mysite.com into a string that it could strip off the .com from and then add a .org to the end redirecting to the new string it would be perfect however I'm not sure how to manipulate strings like that in the iRules world.
Thanks,
Andy