Forum Discussion
Shawn_Diehl_899
Nimbostratus
Aug 21, 2008URL Rewrite (should be basic)
Thanks in advance for the help. I should be able to figure this out but being slammed I just cant seem to get it right. I've already scoured the web and DevCentral and cant find an example I can put to use.
I need to replace any instance of login.aspx with default.aspx in an incoming request. I've figrued out how to catch it when the URL looks something like https://www.mycorp.com/login.aspx but its not working when the URL is something like https://www.mycorp.com/somestring/login.aspx. I figrue I need to use a replace but cant find an example that matches my need.
when HTTP_REQUEST {
if { [HTTP::uri] equals "/login.aspx" } {
HTTP::uri "/default.aspx"
}
}
- Shawn_Diehl_899
Nimbostratus
I am still trying to get the proper solution and came up with this. Any thoughts?? - Nicolas_Menant
Employee
when HTTP_REQUEST { if { [HTTP::uri] ends_with [string tolower "login.aspx"] } { HTTP::uri [string map -nocase {"login.aspx" "default.aspx"} [HTTP::uri]] } }
- Andy_Herrman_22
Nimbostratus
Shouldn't you do the tolower on the URI, not the hard-coded "login.aspx"?when HTTP_REQUEST { if { [string tolower [HTTP::uri]] ends_with "login.aspx" } { HTTP::uri [string map -nocase {"login.aspx" "default.aspx"} [HTTP::uri]] } }
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