Forum Discussion
Url redirect to a subdomain from sepcific URi to subdomain with the same URi
Hi!
Using the pre-formatted option in the forum makes the iRule readable:
when HTTP_REQUEST {
set
if { [HTTP::host] eq "mobile.domain.com" } {
HTTP::respond 301 Location "https://mobile.newdomain.com[HTTP::uri]"
}
if { [string tolower [HTTP::uri]] contains "/mobile" } {
HTTP::respond 301 Location "https://mobile.newdomain.com";
}
}
You state in your question that:
- -> mobile.newdomain.com
- -> mobile.newdomain.com/mobile/news.asp
Looks like the example needs to be updated?
Another tip is to exampine Chrome developer tools to see where the redirect came from (check the server header). Sometimes requests reaches the application.
Final tip, don't set up if conditions with a result of a redirect where both can be matched. It could lead to unpredictable results and/or error messages in your logs. Better to use if/elseif. :)
/Patrik
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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