Categories
Web development

Redirectionare website spre HTTPS

  1. Activarea redirectionarii permanente prin modificarea fisierului de configurare al virtual host
    <VirtualHost *:80> 
    ServerName www.lorand.work
    Redirect permanent / https://www.lorand.work/
    </VirtualHost>
    
    <VirtualHost _default_:443> 
    ServerName www.lorand.work
    DocumentRoot /var/www/httpdocs
    SSLEngine On 
    </VirtualHost>
  2. Activarea redirectionarii folosind fisierul .htaccess
    RewriteEngine On 
    RewriteCond %{HTTPS} !=on 
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]