Name

HTTPRedirectToName

Synopsis

HTTPRedirectToName [format string]
Default [ServerName for the chosen Apache server] 
Directory

Like HTTPRedirectToIP, this tells mod_backhand to redirect instead of proxying. However, in this case it redirects to a DNS name constructed from the ServerName and the contents of the Host: header in the request. By default, it is the ServerName, but for complex setups hosting multiple servers on the same server farm, more cunning may be required to end up at the right virtual host on the right machine. So, the format string can be used to control the construction of the DNS name to which you’re redirected. We can do no better than to reproduce mod_backhand’s documentation:

The format string is just like C format string except that it only has two insertion tokens: %#S and %#H (where # is a number).

%-#S is the server name with the right # parts chopped off. If your server name is www-1.jersey.domain.com, %-3S will yield www-1.

%#S is the server name with only the # left parts preserved. If your server name is www-1.jersey.domain.com, %2S will yield www-1.jersey.

%-#H is the Host: with only the right # parts preserved. If the Host: is www.client.com, %-2S will yield client.com.

%#H will be the Host: with the left # parts chopped off. If the Host: is www.client.com, %1H will yield client.com.

For example, if you run a hosting company hosting.com and you have 5 machines named www[1-5].sanfran.hosting.com. You host www.client1.com and www.client2.com

Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.