Forum Discussion
iRule to hide Query String from URL
Dear F5 Experts,
I am new to F5, We have requirement that we want hide query string externally for End-user, but internally it should use and send request to webServer. Our F5 Team is not aware of to deal with dynamic contents.
Actual URL: http://cmspweb.com/sites/en_US/about/newsroom?year=2015&month=5
Expecting URL: http://cmspweb.com/sites/en_US/about/newsroom/2015/5
Note: Here Year & Month values are dynamic, currently we have years from 2008 to 2016 and months 1 to 12. We were tried lot from WebServer level but didn't help. Our F5 team will update the iRule which we have given. So, Kindly please provide iRule to resolve this issue.
Thanks
Jayaram
6 Replies
- Yann_Desmarest_
Nacreous
Hi,
The below irule can change URI like
to/sites/en_US/about/newsroom/year/month/sites/en_US/about/newsroom?year=year&month=monthwhen HTTP_REQUEST { set path [HTTP::path] if { $path starts_with "/sites/en_US/about/newsroom/" and [URI::path [HTTP::uri] depth] eq "5" } { set year [getfield $path "/" 6] set month [getfield $path "/" 7] set path [URI::path [HTTP::uri] 1 4] HTTP::uri "$path?year=$year&month=$month" } }- JPONNUSAMY_2705
Nimbostratus
Dear Friend,
Actually I am looking the iRule for changing the URL from /sites/en_US/about/newsroom?year=year&month=month to /sites/en_US/about/newsroom/year/month (Reverse)
Kindly please share for the same.
- Yann_Desmarest_
Nacreous
Hi,
Sorry I misunderstood your requirement. Please find below an example of translating the uri the way you want :
when HTTP_REQUEST { set path [HTTP::path] if { $path eq "/sites/en_US/about/newsroom" and [HTTP::uri] contains "year=" and [HTTP::uri contains "month=" ] } { set year [URI::query [HTTP::uri] "year"] set month [URI::query [HTTP::uri] "month"] HTTP::uri "$path/$year/$month" } }
Hi,
The below irule can change URI like
to/sites/en_US/about/newsroom/year/month/sites/en_US/about/newsroom?year=year&month=monthwhen HTTP_REQUEST { set path [HTTP::path] if { $path starts_with "/sites/en_US/about/newsroom/" and [URI::path [HTTP::uri] depth] eq "5" } { set year [getfield $path "/" 6] set month [getfield $path "/" 7] set path [URI::path [HTTP::uri] 1 4] HTTP::uri "$path?year=$year&month=$month" } }- JPONNUSAMY_2705
Nimbostratus
Dear Friend,
Actually I am looking the iRule for changing the URL from /sites/en_US/about/newsroom?year=year&month=month to /sites/en_US/about/newsroom/year/month (Reverse)
Kindly please share for the same.
Hi,
Sorry I misunderstood your requirement. Please find below an example of translating the uri the way you want :
when HTTP_REQUEST { set path [HTTP::path] if { $path eq "/sites/en_US/about/newsroom" and [HTTP::uri] contains "year=" and [HTTP::uri contains "month=" ] } { set year [URI::query [HTTP::uri] "year"] set month [URI::query [HTTP::uri] "month"] HTTP::uri "$path/$year/$month" } }
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