Forum Discussion
URI prefix iRule
I need to know the best iRule match my request
www.common.com should redirect to www.common.com/sites/web/ www.common.com/table should redirect to www.common.com/sites/web/table
I hope my request is clear.
3 Replies
Try this:
when HTTP_REQUEST { switch [string tolower [HTTP::uri] { "/" { HTTP::redirect "www.common.com/sites/web/" } "/table" {HTTP::redirect "www.common.com/sites/web/table" } } }- BPRIDE
Nimbostratus
Dear Robert,
Thanks robert for your swift response. But I'm looking for generic one.
www.common.com should redirect to www.common.com/sites/web/ www.common.com/table should redirect to www.common.com/sites/web/table
www.common.com/sites/web/ should be always there and the remaining URI should add to it
www.common.com/content should redirect to www.common.com/sites/web/content www.common.com/content2 should redirect to www.common.com/sites/web/content2 www.common.com/content3 should redirect to www.common.com/sites/web/content3
I hope this is clear.
So if I understand you correctly, if the URI does not begin with /sites/web you want the user redirected to www.common.com/sites/web with the original URI appended. Something like this:
when HTTP_REQUEST { if { ! ( string tolower [HTTP::uri] starts_with "/sites/web" } { HTTP::redirect "www.common.com/sites/web[HTTP::uri]" } }If the URI sent from the client is / the user will be redirected to www.common.com/sites/web/. If the URI sent from the client is /table the redirect will be www.common.com/sites/web/table, or if the original URI is /abc/1234 the redirect will be www.common.com/sites/web/abc/1234.
Does that sound like what you want?
Robert
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
