The New Redirect Directives


Purpose

The Redirect directives create virtual documents on your server, and any accesses to it will be redirected to a new URL. They also allow people to follow documents that have moved.

Now Available:
Redirect
RedirectTemp
RedirectPermanent


Syntax

Redirect virtual URL
RedirectTemp virtual URL
RedirectPermanent virtual URL

virtual is the translated location which should trigger a redirect..

URL is the URL of the new document.

Several Redirect directives may appear in the configuration file.
The Redirect directives are allowed in all Resource Configuration files (srm.conf) and Per Directory Configuration files (.htaccess).


Example

Redirect /dir1 http://newserver.widget.com/dir1

This would cause requests for /dir1 to be redirected to the new location, http://newserver.widget.com/dir1.


Specifics

In the Resource Configuration file (srm.conf), Redirects do a substring redirection, so that if you use the example above, any request for /dir1/wow would be redirected to http://newserver.widget.com/dir1/wow.

In the By Directory files (.htaccess), Redirects do a full string comparison, such that in the example above, only requests to /dir1 exactly will be redirected to http://newserver.widget.com/dir1.

In Multihome support, Redirects are supported in the default srm.conf file, as well as other configuration files. If you don't give any Alias/ScriptAlias/Redirect directives in the specific resource file, the ones from the default will be used. If you give any of the above in the specific resource file, then only those will be available for that hostname.

Redirect and RedirectTemp return 302 Temporary Redirects (as Redirect has allows done). RedirectPermanent returns 301 Permanent Redirect.


NCSA HTTPd Development Team / httpd@ncsa.uiuc.edu / Last Modified 7-6-95