How to force HTTPS using .htaccess file

HTTPS protocol - currently seems mandatory for everyone on the web. Getting an SSL certificate is now easier than ever. Let’s encrypt allows you to create a secure connection between a user and a web page at the click of a button.

How to enable mandatory HTTPS?

  1. After connecting to the webpage files via FTP, locate the .htaccess file in the public_html directory and open it (if you can't find it, create one).
  2. Enter the following code inside the .htaccess file:
    RewriteEngine On
    RewriteCond% {HTTPS} off
    RewriteRule ^ (. *) $ Https: //% {HTTP_HOST}% {REQUEST_URI} [L, R = 301]
  3. Save the file.
Attention! If the file already contains RewriteEngine On, do not repeat this line. Just paste the code without this line below.

1 COMMENTS

  • Marius says:
    2020-12-30 21:03

    Viskas veikia. Ačiū jums!

SEARCH TUTORIALS

NEWEST TUTORIALS

  • Java 8 and 11 installation to Linux OS

    Java 8 ir 11 įrašymas į Debian/Ubuntu operacines sistemasJei bent kartą bandėte paleisti Minecraft serverį Linux aplinkoje ar tiesiog kitokią programą...

    2021-04-19
  • How to backup your Valheim player data

    How to make Valheim player data copy All game progress (inventory, skills) is stored in the player's files. This means that this information can...

    2021-04-13