Forum Discussion
Changing Host URL without Redirect - IRULE
I have been poking around the forums and couldn't find the exact answer to the IRULE i would like to write; or if its even possible to write this rule.
Here's my scenario. A user enters gear.swimming.com, I want the IRULE to change the HOST URL from gear.swimming.com to www.recreation.com/swimming while viewing the content of gear.swimming.com.
I'm doing this because I want to optimize my SEO's.
Thank you for you time and assistance.
- Michael_YatesNimbostratusHi Jason,
when HTTP_REQUEST { if { !([string tolower [HTTP::host]] equals "www.foo.com") } { HTTP::header replace Host "www.bar.com" You may or may not need to redirect the traffic to a different pool depending on your applicaiton setup pool alternate.website.pool } }
- Jason_44064NimbostratusThanks for the quick reply Michael,
- Michael_YatesNimbostratusI must have misread what you were needing.
when HTTP_REQUEST { If sites exist on the same Virtual Server, this will change the Browser URL and redirect back to this Virtual Server. If they occupy seperate Virtual Servers it will redirect the traffic away from this Virtual Server and the iRule will need to be split. First if on one Virtual Server, Second if on the Second Virtual Server. if { [HTTP::host] eq "gear.swimming.com" } { HTTP::redirect "http://www.recreation.com/swimming" } if { [string tolower [HTTP::host]] equals "www.recreation.com" && [HTTP::uri] starts_with "/swimming" } { In case of Host Headers, replace the Host Value HTTP::header replace Host "gear.swimming.com" Remove /swimming subdirectory HTTP::uri [URI::path [HTTP::uri] 1 1] You may or may not need to redirect the traffic to a different pool depending on your applicaiton setup pool gear.swimming.com.server.pool } }
- Jason_44064Nimbostratusrecreation.com/swimming is basically a dummy directory created for SEO purposes. (assuming this all works out)
Recreation.com = in External Hosting Environment
- Michael_YatesNimbostratusOK. I believe that I understand. If the User Enters: gear.swimming.com you want the browser to display: recreation.com/swimming while showing the content for gear.swimming.com.
- Jason_44064NimbostratusThat's correct Michael.
will recreation.com domain get the credit in terms of SEO?
- Michael_YatesNimbostratusIs there anyway of doing this without redirects?
- hooleylistCirrostratusI think Jason wants clients to access gear.swimming.com and have LTM proxy requests to www.recreation.com/swimming. This is possible to do with the ProxyPass iRule:
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