Ormai l’https (HTTP over SSL) è un requisito fondamentale per ogni sito web e grazie a Let’s Encrypt e/o Cloudflare, per fortuna, possiamo averlo senza pagare un solo centesimo 😀
L’HyperText Transfer Protocol over Secure Socket Layer (HTTPS), (anche noto come HTTP over TLS, HTTP over SSL e HTTP Secure) è un protocollo per la comunicazione sicura attraverso una rete di computer, il quale è largamente utilizzato su Internet.
—
Fonte: https://it.wikipedia.org/wiki/HTTPS
Immagine in anteprima: Di Sean MacEntee – https://flic.kr/p/qi1eYu, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=41015981
Io, ad esempio, qui su L’AltroWeb, uso un certificato #letsencrypt + #cloudflare strict (impostato a strict grazie alla presenza del certificato proprietario).
Riguardo a letencrypt – su #cPanel o #Plesk, spesso troviamo strumenti automatici per averlo con pochi click!
Diversamente, se abbiamo un blog WordPress, possiamo provare: WP Encrypt
Se preferiamo fare manualmente, invece, possiamo usare l’ottimo servizio offerto da: ZeroSSL
L’ultimo passo è creare i file nella directory in oggetto, con la stringa indicata, e quindi procedere per la verifica!
Se la verifica sarà valida, sarà possibile scaricare il certificato (vi prego di perdonarmi se non procedo all’ultimo step, ma ho già il certificato e non mi sembra sensato procedere per ricrearlo).
Sistemato il certificato “proprietario” possiamo anche mettere cloudflare!
(e avendo un certificato valido, possiamo benissimo attivare la modalità strict)

Bene! Adesso abbiamo letsencrypt + cloudflare!
Con cloudflare possiamo anche attivare alcune chicche niente male come:
- TLS 1.3;
- Automatic HTTPS Rewrite;
- Opportunistic Encryption;
- Authenticated Origin Pulls;
- HTTP Strict Transport Security (HSTS);
Attivando tutte queste simpatiche cose possiamo ottenere un livello di qualità davvero impeccabile:

Ok! Abbiamo un certificato sul server grazie a letsencrypt; abbiamo cloudflare con tutte le sue fantastiche feature; una bella A+ su ssllabs;
Cosa manca? Manca un bel redirect da http:// a https:// e sistemare i link interni nei vecchi articoli!!!
.htaccess +https://www
## Force +https://www.* RewriteCond %{HTTPS} !on [OR] RewriteCond %{SERVER_PORT} !^443$ [OR] RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ https://www.miosito.it/$1 [R=301,L]
.htaccess +https:// (senza www)
## Force +https://* RewriteCond %{HTTPS} !on [OR] RewriteCond %{SERVER_PORT} !^443$ [OR] RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteRule ^(.*)$ https://miosito.it/$1 [R=301,L]
wp-config.php
/* SSL */ define( 'FORCE_SSL_ADMIN', true ); define('WP_HOME','https://www.miosito.it'); define('WP_SITEURL','https://www.miosito.it');
In determinate circostanze, però, potremmo ritrovarci un loop redirect (mi è capitato, ad esempio, su AlterVista).
In tal caso possiamo procedere così:
.htaccess
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / ## Force +https://* RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://miosito.altervista.org/$1 [R=301,L] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
wp-config.php
/* SSL */ define('FORCE_SSL_ADMIN', true); // in some setups HTTP_X_FORWARDED_PROTO might contain // a comma-separated list e.g. http,https // so check for https existence if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) { $_SERVER['HTTPS'] = 'on'; } define('WP_HOME','https://miosito.altervista.org/'); define('WP_SITEURL','https://miosito.altervista.org/');
Fatto questo, tocca soltanto modificare i vecchi url nel database e possiamo farlo comodamente grazie a qualche semplice plugin.
Ad esempio:
Perfetto!
- Abbiamo il certificato gratuito (non necessario, ma male non fa di certo!);
- fix nel config e nell’htaccess > dunque redirect corretto da http a https;
- modifiche al database fatte in comodità con pochi click.
Se tutto è stato fatto correttamente, non dovremmo avere noie di “mixed content” e quindi avremo il nostro bel lucchetto verde nella barra degli indirizzi:
Direi che è tutto 🙂
Se avete dubbi, consigli, perplessità, non vi rimane altro da fare che chiedere 😉
[amazon_link asins=’1907117040,B01HSYYCMW,B01K3PP6Y6,B00X9IQARC’ template=’ProductCarousel’ store=’lal0a-21′ marketplace=’IT’ link_id=’9db1497e-f798-11e6-9e27-3f05b0e38fef’]