2.3.119 Redirect
Redirect redirects the requests sent from clients.
Description
Redirect redirects the requests sent from clients to the old path, to a new path.
If a request for the old path was received, a response with the specified status code and a new path set to the Location header is returned. Normally, if the web browser receives a 300-series status code, the browser automatically redirects requests to the address specified in the Location header.
The Redirect directive redirects a request for a specific file to another specific file, or redirects a request for a path in a specific directory to a path with the same name in another specific directory. To redirect a request for a path in a specific directory to another specific directory, use the RedirectMatch directive.
Syntax
Redirect [{permanent|temp|seeother|gone|status_code}] old_path new_path
Specifiable values
- permanent
-
Specify this value if you want to send the status code 301 Moved Permanently.
- temp
-
Specify this value if you want to send the status code 302 Found.
- seeother
-
Specify this value if you want to send the status code 303 See Other.
- gone
-
Specify this value if you want to send the status code 410 Gone. You cannot specify new_path.
- status_code
-
Specify this value if you want to send the specified status code.
Note that, if a status code other than a 300-series status code is specified, you cannot specify new_path.
- old_path
-
Specify a path of a request URL that starts with a forward slash. Note that, for old_path, you cannot specify the path after ? (an inquiry string).
The specification for old_path cannot be the same as the value specified in the following directive:
-
path_name_specified_for_ProxyPass
For example, you cannot specify a path such as the following:
Redirect temp /aaa/bbb/ http://aaa.example.com/ ProxyPass /aaa/ http://aaa.example.com/
-
- new_path
-
Specify a path of a URL that includes protocol_name://host_name[:port_number]. For the URL to be specified as new_path, you can also specify an IPv6 address or a host name that corresponds to the IPv6 address.
Locations where it can be written
httpsd.conf, <VirtualHost>, <Directory> and .htaccess
Overwrite permission
FileInfo level
Example
Redirect temp /index.html http://host_name:port_number/default.html
A request for /index.html will be redirected to http://host_name:port_number/default.html with the status code 302.