Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

iRule that saves subdomain

Mike_Monti
Nimbostratus
Nimbostratus

I have a number of different subdomains (wwwdev, wwwapps, things like that) and I want to use an iRule to force the domain from .com to .org. 

Example force anyone that types in wwwdev.mydomain.com to arrive at wwwdev.mydomain.org

I've historically set this up using specific iRules for each subdomain, one on each farm. but that ends up being a lot of iRules that have to be updated when I'm sure I could just make one iRule that could be plugged in everywhere.  I'm also pretty sure this is an easy fix but my googling just isn't cutting it.

 

Any help would be appreciated!

Thanks,

Mike

 

 

1 ACCEPTED SOLUTION

Hi Mike,

Can you try this iRule?

when HTTP_REQUEST {
	if { [HTTP::host] ends_with ".mydoamin.com" } {
		HTTP::redirect https://[string map {".com" ".org"} [HTTP::host]][HTTP::uri]
		return
	}
}

View solution in original post

2 REPLIES 2

Hi Mike,

Can you try this iRule?

when HTTP_REQUEST {
	if { [HTTP::host] ends_with ".mydoamin.com" } {
		HTTP::redirect https://[string map {".com" ".org"} [HTTP::host]][HTTP::uri]
		return
	}
}

Mike_Monti
Nimbostratus
Nimbostratus

Thanks for this, I've thrown it into dev and am checking it in a few places. So far so good!