Forum Discussion
Bob_10976
Nimbostratus
Oct 22, 2008Redirecting Only Specfic URL Address
Hello All,
I've been task to setup a iRule that will redirect a url, subsite.mysite.com to mysite.com It actually seems pretty simple but the problem is subsite.mysite.com typically has a trailing site, actually a ton of training sites or services, meaning it looks like subsite.mysite.com/webservice or subsite.mysite.com/application. When I create a redirect iRule it ends up redirecting everything and I only want it to apply if the url matches subsite.mysite.com excatly, anything else shouldn't be redirected. Below is an example of the iRules I attempted but didn't get to work.
Any thoughts or suggestion would be appreciated...
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] equals "subsite.mysite.com ") || ([string tolower [HTTP::host]] equals "www.subsite.mysite.com ")} {
if { ([string tolower [HTTP::host]] equals "subsite.mysite.com ") || ([string tolower [HTTP::host]] equals "www.subsite.mysite.com ") } {
HTTP::respond 301 Location http://mysite.com/
}
}
}
AND
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] equals "subsite.mysite.com ") || ([string tolower [HTTP::host]] equals "www. subsite.mysite.com ")} {
HTTP::respond 301 Location http://mysite.com/
}
}
I did try a trailing slash (/) at the end of "subsite.mysite.com " but that didn't seem to make a difference.
Thanks in advance..
Bob
- dennypayne
Employee
Posted By sklingner on 10/23/2008 11:44 PM
- dennypayne
Employee
Posted By BobMc on 10/22/2008 12:57 PM
- Bob_10976
Nimbostratus
Hey sorry haven't gotten back sooner... - dennypayne
Employee
Again, the subsite.mysite.com is the host, so what you need is: - Bob_10976
Nimbostratus
Ok, that makes sense.... - Bob_10976
Nimbostratus
Ok...Sorry...I didn't read your post very good the first time...the host name stays as "host" but the URI is "/"...
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