Author Topic: How To Force SSL with Letsencrypt?  (Read 15636 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How To Force SSL with Letsencrypt?
« on: October 03, 2016, 07:46:12 AM »
Hello,

I have installed Letsencrypt on my domain.

(1)my sites is okay with https://www.domain.name
(2)but, still okay with http://HTTP://www.domain.name
(3)I want to force HTTP to HTTPS, I mean when visitor open site http://www.domain.name it should forced to http://HTTPS://www.domain.name.

Can you help me?

Thank you very much.

Offline
*
Re: How To Force SSL with Letsencrypt?
« Reply #1 on: October 03, 2016, 05:49:35 PM »
Hi,
You can force redirection in .htaccess file, just add this section:

Code: [Select]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

where, example.com is your domain.

Offline
*
Re: How To Force SSL with Letsencrypt?
« Reply #2 on: October 07, 2016, 04:20:12 PM »
Thank you very much for the respond.

I have tried that but unsuccessfull.

FYI,
(1) I use "Apache & Varnish Cache & Nginx Reverse Proxy ", is this a problem?
(2) I have my httaccess file like this;
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Thanks again.

Offline
*
Re: How To Force SSL with Letsencrypt?
« Reply #3 on: January 30, 2017, 03:14:24 PM »
you can either edit the /usr/local/apache/conf.d/vhosts.conf file directly or through the panel at Apache Settings/Edit Apache vHosts and add this to each vhost:
Redirect / https://www.yourdomainname.com/