Redirects


Apache can respond to a request for a URI by asking the client to request a different URI. This response is called a redirect. A redirect works because redirection is part of the HTTP implementation: Apache sends the appropriate response code and the new URI, and a compliant browser requests the new location.

The Redirect directive can establish an explicit redirect that sends a client to a different page when a Web site is moved. Or, when a user enters the URI of a directory in a browser but leaves off the trailing slash, Apache can automatically redirect the client to the same URI terminated with a slash.

UseCanonicalName


The ServerName directive (page 796), which establishes the name of the server, and the UseCanonicalName directive (page 805) are both important when a server has more than one name and needs to perform an automatic redirect. For example, assume the server with the name zach.example.com and the alias www.example.com has ServerName set to www.example.com. When a client specifies a URI of a directory but leaves off the trailing slash (zach.example.com/dir), Apache has to perform a redirect to determine the URI of the requested directory. When UseCanonicalName is set to On, Apache uses the value of ServerName and returns www.example.com/dir/. With UseCanonicalName set to Off, Apache uses the name from the incoming request and returns zach.example.com/dir/.




A Practical Guide to Red Hat Linux
A Practical Guide to Red HatВ® LinuxВ®: Fedoraв„ў Core and Red Hat Enterprise Linux (3rd Edition)
ISBN: 0132280272
EAN: 2147483647
Year: 2006
Pages: 383

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net