Name
UseCanonicalName
Synopsis
UseCanonicalName on|off
Default: on
Server config, virtual host, directory, .htaccess
This directive controls how Apache forms URLs that refer to itself,
for example, when redirecting a request for http://www.domain.com/some/directory to the
correct http://www.domain.com/some/directory/ (note the trailing / ). If
UseCanonical-Name
is on
(the
default), then the hostname and port used in the redirect will be
those set by ServerName
and
Port
(not Apache v2)
. If it is
off
, then the name and port used will be the ones
in the original request.
One instance where this directive may be useful is when users are in
the same domain as the web server (for example, on an intranet). In
this case, they may use the “short”
name for the server (www,
for example), instead of the fully qualified domain name (www.domain.com, say). If a user types a
URL such as http://www/APACHE3/somedir (without the
trailing slash), then, with UseCanonicalName
switched on
, the user will be
directed to http://www.domain.com/somedir/. With
UseCanonicalName
switched off
,
she will be redirected to http://www/APACHE3/somedir/. An obvious case
in which this is useful is when user authentication is switched on:
reusing the server name that the user typed means she
won’t be asked to reauthenticate when the server
name appears to the browser to have changed. More obscure cases
relate to name/address translation caused by some firewalling
techniques.
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.