Skip to main content

Knowledge base

Configuring Redirects on Apache Web Server

A redirect on your Web server is a change of end destination for the client request.

For example, the website has moved to a new domain and a redirect is set from its old URL, so that visitors will automatically go to to the new address using the old URL in their browsers, and the website will successfully load. If you installed an SSL certificate, your website should operate on the https protocol instead of the http protocol, which also requires a redirect set up.

Any Apache Web server redirect rules will work only if the module is enabled. If the module is already enabled, proceed to the .htaccess file configuration for the desired redirect, as described below.

To load the mod_rewrite module on the Web server, add the following line to the Apache configuration file:

LoadModule rewrite_module /usr/lib/apache2/modules/
Furthermore, in the Apache configuration file, locate the "" section and append the line:
AllowOverride all
This will further enable the use of mod_rewrite module commands in the .htaccess file. Restart the Web server using the command:
apachectl restart


apache2ctl restart
Return to category