Forum Discussion
Mike_Wethington
Nimbostratus
Oct 18, 2010Redirect to new uri with part of original uri
I am trying to redirect a url by using a portion of old a new.
original request
http://www.mysite.com/udpate/blahblah
redirected to
http://www.mysite.com/profile/beta/...d=blahblah
i need to look for the /update/ (from the original request) and take everything after the update/blahblah (so the blahblah) and tack it on to the end of http://www.mysite.com/profile/beta/page.aspx?id=
I am struggling to get this done. Any help would be appreciated.
3 Replies
Sort By
- hoolio
Cirrostratus
Hii Mike,when HTTP_REQUEST { Check if URI starts with /update if {[string tolower [HTTP::uri]] starts_with "/update"}{ Redirect the request HTTP::redirect "http://www.mysite.com/profile/beta/page.aspx?id=[URI::encode [string range [HTTP::uri] 7 end]]" log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting [HTTP::uri]\ to http://www.mysite.com/profile/beta/page.aspx?id=[URI::encode [string range [HTTP::uri] 7 end]]" } }
- Mike_Wethington
Nimbostratus
Thank you for the respone. So if i understand correctly the statement [HTTP::uri] 7 end]] will only take what appears after the /update/ correct? - hoolio
Cirrostratus
Exactly:
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