How To Force SSL with Letsencrypt?

Started by asrof_id, October 03, 2016, 07:46:12 AM

Previous topic - Next topic

asrof_id

Hello,

I have installed Letsencrypt on my domain.

(1)my sites is okay with https://www.domain.name
(2)but, still okay with 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 HTTPS://www.domain.name.

Can you help me?

Thank you very much.

je2u

Hi,
You can force redirection in .htaccess file, just add this section:


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


where, example.com is your domain.

asrof_id

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.

mhu

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/