Forum Discussion
f5now_28704
Nimbostratus
Aug 29, 2007301 redirects
Hi Guys.
I have a question, with my iRule set, I have about 40 domains going to one Virtual Server(192.168.1.200).
Now Marketing wants to redirect 301, 10 domains of the 40.
here is my irule for simple 301 redirection, this works but(trying to avoid changing all the DNS records) is there a way to setup this rule just to answer for 10 of the domains and pass the other 30 to where ever they needed to go?
-----------------------
when HTTP_REQUEST {
HTTP::respond 301 Location "http://[getfield www.abc.com ":" 1][HTTP::uri]"
}
-----------------------
Thanks for the Help
Ryan
- Sure thing. You can either put all the domains you want redirected into a class (Data Group). Look at the wiki for matchclass and you'll see an example. Or, you could hard code it in your iRule with a switch statement
when HTTP_REQUEST { switch [HTTP::host] { www.domain1.com - www.domain2.com - www.domain3.com - www.domain4.com - www.domain5.com - www.domain6.com - www.domain7.com - www.domain8.com - www.domain9.com - www.domain10.com { HTTP::respond 301 Location "http://www.abc.com[HTTP::uri]" } } }
- f5now_28704
Nimbostratus
Right on, that worked like a champ. thanks for all the help.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects