Forum Discussion
Richie_66774
Nimbostratus
Sep 15, 2009Redirect a small URL to the real URL
I am trying to rewrite a request that I receive like this:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/anything" } {
HTTP::uri "/default.aspx?=anything"
}
}
Except the "anything" needs to be a [uri::path] or something so when it changes all the time it will insert the parameter for the full URL Path.
3 Replies
- hoolio
Cirrostratus
Do you want to take the whole URI and set it as a parameter value? If so, you should URI encode the value:when HTTP_REQUEST { Check if the URI set to lower case starts with /anything if { [string tolower [HTTP::uri]] starts_with "/anything" } { Rewrite the URI to /default.aspx with a new parameter and the value set to the URI encoded original URI HTTP::uri "/default.aspx?original_uri=[URI::encode [HTTP::uri]]" } }
- Richie_66774
Nimbostratus
hi this is not working... it rewrites only to the default.aspx without the parameter. - hoolio
Cirrostratus
If you want to rewrite all URI's you can just remove the if clause:when HTTP_REQUEST { Rewrite the URI to /default.aspx with a new parameter and the value set to the URI encoded original URI HTTP::uri "/default.aspx?original_uri=[URI::encode [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