Accueil > Hébergement , Programmation , sécurité > Force HTTPS avec PHP ou. htaccess

Forcer HTTPS avec PHP ou. Htaccess

Si votre site utilise un certificat SSL, apprendre à forcer l'ouverture du site seulement avec https:// ou file en utilisant PHP. Htaccess

Comment utiliser PHP:

<?php
if ( $_SERVER [ 'SERVER_PORT' ] != '443' ) {
header( 'Location: https://' . $_SERVER [ 'HTTP_HOST' ]. $_SERVER [ 'REQUEST_URI' ]);
exit ();
}
?>

Comment en utilisant le fichier htaccess (recommandé).:

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

Ce message a été vu 90 fois.


  1. Pas encore de commentaires.

Protection contre le spam par WP-SpamFree Plugin