How to configure web server redirects
A web server redirect is configured in the HTTP headers of the web server. This can easily be done with a header() command being inserted in the page. The header command usually consists of 2 values, the HTTP code (number) and the new HTTP address of the page. The HTTP code is always a 301 (Moved Permanently) or HTTP 302 (Moved Temporarily). The referral address must always be a valid HTTP link.
To ensure the most reliable implementation, the HTTP 301 (Moved Permanently) code is recommended. This makes it clear to the robots, the indexers of search engines, that the new website address is permanent.
For redirects to maintenance pages, the HTTP 302 (Moved Temporarily) code could also be used, because a maintenance page is generally only applied during a temporary inference of services.