Forum Discussion
URL redirection based on port and path
I need help to redirect the URLs
https://web.example.com
https://web.example.com/Site/
https://web.example.com/site/
https://web.example.com:9443/
https://web.example.com:9443/Site/
https://web.example.com:9443/site/
to
https://web.example.com:9443/Site/
,
Now as you want redirection on port 443 as well as 9443, so you would need two separate virtual servers using same IP (which is associated with web.example.com) which will be listening on both these ports. You can also have single virtual server which will listen on both ports using port list option.
First 3 redirection will be carry out by virtual server which is listening on port 443 and remaining redirections will be done by virtual server which is listening on port 9443.
You can bind below iRule to each of the virtual server for the redirection.
when HTTP_REQUEST { if { [HTTP::host] contains "web.example.com"}{ if { ([HTTP::uri] equals "/") || ([HTTP::uri] equals "/Site") || ([HTTP::uri] equals "/site")}{ HTTP::redirect https://web.example.com:9443/Site/ } } }
Hope it helps!
Mayur
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