Forum Discussion
Redirect URL with URL attached
Hi,
I'm new to F5 and have a question regarding URL redirect. The task is to change the server URL but leave the URL path untouched. An example would be:
redirect www.company.de/abc/xyz/ to www.company.com/abc/xyz/
Is there any way how I can achieve this? Right now I'm simply redirecting the domain part of the URL, but any user is then redirected to the main page instead of the requested URI.
My iRule looks like
when HTTP_REQUEST { if {[HTTP::host] equals "some.company.de"} { HTTP::redirect "https://some.company.com" } }
Any suggestion is appreciated. Best regards,
Oliver Stock
2 Replies
- Stanislas_Piro2
Cumulonimbus
Hi,
When requesting www.company.de/abc/xyz/ the HTTP request is:
GET /abc/xyz/?param1=value1¶m2=value2 HTTP/1.1 Host: www.company.de User-agent: Mozilla... Other-HeadersWhen working with HTTP:
- www.company.de is HTTP Host : variable [HTTP:host]
- /abc/xyz/?param1=value1¶m2=value2 is the uri : variable [HTTP:uri]
- /abc/xyz/ is the path : variable [HTTP:path]
- param1=value1¶m2=value2 is the query string : variable [HTTP:query]
Try the following irule:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "some.company.de"} { HTTP::redirect "https://some.company.com[HTTP::uri]" } } - OliverS_221234
Nimbostratus
Hi Stanislas,
we've tested your proposal, and it works fine. Thanks a lot for your help, it was really appreciated. Best regards,
Oliver Stock
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