Produs Perioada
Nici un produs selectat


Force Apache SSL only with .htaccess

After you have already configured apache ssl hosts, install your certificate and check the SSL communication, you may want to force SSL only communication with your site!

Following howto guideline have the advantage of redirecting http trafic to SSL encripted trafic, using 301(permanent move) HTTP1.1 redirect header. It is not necessary to make any modification in your application.

  1. Log on your server, and navigate to directory from where the Apache serve your files for your domain.
    This can be /var/www/httpd/, /var/www/html/, or other, depending on your Apache's distribution and your settings.

  2. Start to edit .htaccess in your prefered editor.
  3. Add following lines in .htaccess
    RewriteEngine on
    RewriteBase /
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$$1 [R=permanent,L]
    ..other settings

  4. Save the changes to the .htaccess file. Usualy you don't need to restart the Apache server process.

  5. Test your instalation. You can try to open in your browser address like and check you are redirected trought SSL connection (starting with https). You can check also the access log for 301 redirect header!

  6. Please replace with your site address :)!

Need direct support? contact us.