Forum Discussion
URL Redirect without carrying over path
Hi, I am using this same redirect iRule I used for http to https which works flawlessly for me (except the irule below is stripped from the
Now all I want is a simple redirect from www.helloworld.com to "http://maintenance.mydomain.com". Right now, when someone types in helloworld.com on their browser, it works perfectly by redirecting to "http://maintenance.mydomain.com". However, the problem is when someone comes in to the site following a URL that contains a path "http://www.helloworld.com/aboutus.html" the iRule does this "http://maintenance.mydomain.com/aboutus.html". I don't have a page "aboutus.html" so it returns an error on the browser.
How can I make the redirect not carry over the path and strip it off completely so no matter what path they're trying to access and as long as the hostname contains "helloworld" to redirect it to exactly http://maintenance.mydomain.com ?
Here is the iRule I'm using for the redirect
when HTTP_REQUEST {
if { [HTTP::host] contains "helloworld"} {
HTTP::redirect http://maintenance.mydomain.com[HTTP::uri]
}
}
1 Reply
- Sonny_J_Bonds_1
Nimbostratus
OK guys, never mind. I could have swore I did this earlier and it didn't work. All I did was removed "[HTTP::uri]"
So here is how my irule looks like now in case someone out there runs through the same scenario. It works exactly how I want it to now, thank you anyway.
when HTTP_REQUEST { if { [HTTP::host] contains "helloworld"} { HTTP::redirect http://maintenance.mydomain.com } }
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