Forum Discussion
Need help in redirection
Hi,
I need help as we have a requirement to redirect from one site to another site by keeping all content after / as same...example..if user tries to access abc.com/aa it should redirect to def.com/aa...similarly if he tries to access abc.com/bb it should get redirected to def.com/bb.
Any help is appreciated.
2 Replies
- Leonardo_Souza
Cirrocumulus
You can create an iRule using the HTTP:path to check what the user is accessing, and also HTTP::redirect to redirect the client to the new URL.
This page has examples you can use to create the iRule:
https://devcentral.f5.com/wiki/irules.http__path.ashx
- Stephane_Viau
Nimbostratus
Dixit,
Use the following iRule :
when HTTP_REQUEST { HTTP::respond 301 Location http://nameofyournewsite.com[HTTP::uri] }Just replace 301 by 302 if it's temporary and replace [HTTP::uri] by [HTTP::path] if you wish to keep the path but not the query string. [HTTP::uri] will keep both path and query string.
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