Forum Discussion
url rewrite request
I need to perform url rewrite wherein my original url will be https://abc.com and its subdirectories as well like https://abc.com/abc or https://abc.com/abc/xyz
My requirement is to add www before the url host portion. for eg: https://abc.com to https://www.abc.com , https://abc.com/abc to https://www.abc.com/abc, https://abc.com/abc/xyz to https://www.abc.com/abc/xyz
Kindly help with an iRule to achieve the same as i've tried multiple iRules but they don't work.
Regards,
Babar Ansari
Did you tried to use rewrite profile for this requirement?
- spalandeNacreous
Rewrite is on the serverside of the session, which is from the F5 to the backend server and it won't be visible to the clients on browsers. If you need a rewrite of the HOST header on the serverside of the session you can use below iRule
when HTTP_REQUEST { set host [string tolower [HTTP::host]] if {$host eq "abc.com"}{ HTTP::header replace "Host" "www.abc.com" return } }
Redirect is a is a client-side request to have the web browser go to another URL. This means that the URL that you see in the browser will update to the new URL. If you are looking for a redirect, below is the iRule
when HTTP_REQUEST { set host [string tolower [HTTP::host]] if {$host eq "abc.com"}{ HTTP::respond 301 Location "https://www.abc.com[HTTP::uri]" return } }
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