X

How to redirect an HTTP connection to HTTPS in Apache webserver

HTTP connections can be redirected to HTTPS using the apache mod_rewrite module. Mod_rewrite should be available in every apache installation.

Apache HTTP to HTTPS Redirect

Create a file with the name .htaccess in the website root directory which contains the following lines:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

If you use ISPConfig 3, you can add these lines also in the apache directives field of the website settings form instead of adding them to a .htaccess file. Or use the HTTP to HTTPS redirect option on the redirect tab of the site. But the approach with the .htaccess file will work on ISPConfig as well.

Categories: Server Webserver
Till Brehm:
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings