rmangram_77953
Aug 14, 2013Nimbostratus
Keeping only specific URI's from Redirecting
I am trying keep certain URI's from redirecting to a new site. Just to breakdown what I am trying to do:
- When the users Types in Oldsite.com, they are redirecting to a landingPage. This works fine via HTTP or HTTPS.
- If Users types in Oldsite.com/Marketing they are redirected to newsite.com/Marketing. This works fine via HTTP or HTTPS.3. If users are going to oldsite.com/teamsites/hr, oldsite.com/teamsites/finance, and oldsite.com/teamsites/it. I want them to stay to the oldsite and not be redirected to anywhere. They have to stay there until these pages are moved to the new site.
If users types in oldsite.com/teamsites/ I want to redirect them to https://newsite.com/sites.
Here is my Irule Script below. Thanks
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] ends_with "oldsite.com" } {
set uri [string tolower [HTTP::uri]]
if { $uri equals "/" } {
HTTP::respond 301 Location "https://landingpage.com"
} elseif { $uri starts_with "/teamsites/it/" or $uri starts_with "/teamsites/finance/" or $uri starts_with "/teamsites/hr/" } {
if { [TCP::local_port] == 80 } {
HTTP::respond 302 noserver Location ""
}
} else {
HTTP::respond 302 noserver Location ""
}
}
}