http to https rewrite

1. Use the command:

a2enmod rewrite

2. Find inside the directory /etc/apache2/sites-available/ .conf file that serves your domain (check ServerName or DocumentRoot directory);

3.Add a SEPARATE block:

<VirtualHost *:80>
    ServerName <domena>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA]
</VirtualHost>

4. Use the command:

service apache2 restart
faq/support/linux/apache2/http-to-https-redirect.txt · Last modified: 2019/04/10 08:51 by 127.0.0.1
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0