Forum Discussion
Jovanny_Basilio
Nimbostratus
Mar 15, 2010Simple URL redirect
I have a need for a simple iRule that will redirect based on url...to put it simple I am trying to redirect
domain.com ---> to www.domain.com
domain.com/abc ---> www.domain.com/abc
domain.com/user ---> www.domain.com/user
fairly straightforward, currently just have a simple redirect rule to that forwards any http request to www.domain.com, would like to know include these particular paths. Thanks.
-J
- naladar_65658
Altostratus
This one should do what you are looking for:when HTTP_REQUEST { HTTP::redirect "http://www.[HTTP::host][HTTP::uri]" }
- JRahm
Admin
You'd want to check to make sure that the www. wasn't submitted:when HTTP_REQUEST { if { [HTTP::host] eq [domain [HTTP::host] 2] } { HTTP::redirect "http://www.[HTTP::host][HTTP::uri]" } }
- Good point Citizen, if you don't, you'll be redirecting to www.www.domain.com, if indeed you're using the same VS in dns...
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