Kemp Support, how can we help?

The latest application delivery knowledge and expertise at your fingertips.

Remove WWW from request

 

Information

 

Summary:

If a user types in www.example.com, need the www removed.

Environment:

Product: LoadMaster

Version: Any

Platform:  Any

Application: Any

Question/Problem Description:

Remove www from request.

Steps to Reproduce:  
Error Message:  
Defect Number:  
Enhancement Number:  
Cause:  
Resolution:

There are several options for how to do this:

  • Create a rule using the WUI use the following parameters

Rule type = Replace Header
Header Field = Host
Match String = /^www\.example\.com$/
Replace with = example.com

***Once the rule is created, it will be applied within the Virtual Service configuration under the HTTP Header Modifications as a request rule.

 

  • Command to create a rule using API

https://(LoadMasterIPAddress)/access/addrule?name=(RuleName)&type=3&matchtype=regex&header=Host&pattern=%2F%5Ewww%5C.example%5C.com%24%2F&replacement=example.com

  • Command to create a rule using Powershell

$LoadMaster_Address=
$LoadMaster_Port=
$Rule_Name=

New-AdcContentRule -Credential bal -LBPort $LoadMaster_Port -LoadBalancer $LoadMaster_Address -RuleName $Rule_Name -Type 3 -Header Host -MatchType regex -Pattern /^www\.example\.com$/ -Replacement example.com

 

  • Using subVSs and a Redirect

Create two SubVSs within the Virtual Servuce.  On one, a Rule to match host header for www.example.com would be use and this SubVS would perform a 301 permanent redirect to https://example.com%s.  The second SubVS will have a Rule to match example.com and send traffic to the Real Servers.  This will show the change of removing the www in the browser to the users.

 

Workaround:  
Notes:  

Was this article helpful?
0 out of 0 found this helpful

Comments