Forum Discussion
Mike_Graston_10
Nimbostratus
Dec 03, 2006Redirects or appends
I was wondering I have about 20 or so redirects for urls because my development team will not put them on the servers. If a uri does not have a / at the end of it would it be possible to append this w...
hoolio
Cirrostratus
Dec 04, 2006It sounds like you're unsure of what methodology to use for determining when to change the URI. If it's a relatively small, known list of URIs you want to redirect, you could define them in a class and then rewrite the URI or redirect based on the class definition.
Or if it's not a known list, you could look for any URI that has a period and then some set number of characters and append a trailing slash (ie, append a slash if there is a . followed by less than 4 characters that doesn't end with a forward slash).
To use the first method, define a class (aka datagroup in the GUI) with the URIs you want to redirect for:
class uris_to_redirect {
"/app1"
"/app2"
"/another_uri_to_change"
}Then use a rule like this to redirect clients requesting one of these URIs:
when HTTP_REQUEST {
if { [matchclass [string tolower [HTTP::uri]] equals $::uris_to_redirect] }{
HTTP::redirect "http://[HTTP::host][HTTP::uri]/"
}
}Note that I didn't test this for syntax, but I think it's one valid example of how to handle the scenario you are describing.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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