Forum Discussion
Russell_Findley
Nimbostratus
Jan 23, 2006Redirect Rule from WWW to Unique URL
I am unable to train our customers to stop using WWW in front of their url so I wanted to write a rule to redirect them, but I need some help with the syntax.
I'm trying to do the following.
Redirect www.x.foo.com to x.foo.com
This rule would only be applied to one virtual node on our bigip.
- Colin_Walker_12Historic F5 AccountI think what you're looking for would look something like this:
if (http_uri starts_with "www") { redirect to "http://something.%h/%u/" }
- Russell_Findley
Nimbostratus
Let me be more specific because the rule didn't work. - Colin_Walker_12Historic F5 AccountThat does change things a bit.
if (http_host starts_with "www.") { redirect to (substr(http_host, 4) + http_uri) }
- Russell_Findley
Nimbostratus
Sorry, but I'm not familiar with this syntax. - Colin_Walker_12Historic F5 AccountWell, you can read more about it here:
- Russell_Findley
Nimbostratus
It's almost like the Bigip isn't taking the new rule when I apply it. Should I do a b load to update the config? - Russell_Findley
Nimbostratus
If I use if - Martin_MachacekHistoric F5 AccountRussell,
rule redirect_to_x.foo.com { redirect to "x.foo.com" + http_uri } virtual :80 { use rule redirect_to_x.foo.com } proxy :443 { target virtual :80 }
rule redirect_to_x.foo.com { if(http_host == "www.x.foo.com") { redirect to "x.foo.com" + http_uri } else { use pool } }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects