Forum Discussion
uri rewrite or redirect
Hello
I would like to setup an irule to enforce the url used to access a site.
For example, for site http://lab.test.com/login.
If someone tries to alter the url to http://www.lab.test.com/login, they should be redirected to http://lab.test.com/login.
This should be true for any uri that includes www.lab.test.com
4 Replies
- Kevin_Stewart
Employee
So the URI should ALWAYS be /login? If so, then:
when HTTP_REQUEST { HTTP::uri "/login" }This would forcibly replace any incoming URI with "/login".
- Diego_23471
Nimbostratus
no. It could be anything. I am trying to remove www.
If I type www.lab.test.com/login. I should be redirected to lab.test.com/login
If I type www.lab.test.com/zxw2389s . I should be redirected to lab.test.com/zxw2389s
- Kevin_Stewart
Employee
Ah, so:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] ne "lab.test.com" } { HTTP::redirect "http://lab.test.com[HTTP::uri]" } } - Diego_23471
Nimbostratus
Great. Thx.
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