- Vérifier si le module "rewrite_module" est bien installé et chargé
[root@ip-172-31-37-139 httpd]# httpd -M | grep rewrite
rewrite_module (shared)
- Configurer la redirection dans la configuration de votre vhost
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- Redémarrer votre service httpd
[root@ip-172-31-37-139 blog]# systemctl restart httpd
- Vérifier la redirection. Indices code 301 et le paramètre Location
[root@ip-172-31-37-139 blog]# curl -sv -k http://eniblog.ddns.net
* Host eniblog.ddns.net:80 was resolved.
* IPv6: (none)
* IPv4: 3.149.173.103
* Trying 3.149.173.103:80...
* Connected to eniblog.ddns.net (3.149.173.103) port 80
* using HTTP/1.x
> GET / HTTP/1.1
> Host: eniblog.ddns.net
> User-Agent: curl/8.11.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 09 Sep 2025 19:23:16 GMT
< Server: Apache/2.4.62 (Amazon Linux) OpenSSL/3.2.2
< Location: https://eniblog.ddns.net/
< Content-Length: 233
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://eniblog.ddns.net/">here</a>.</p>
</body></html>
* Connection #0 to host eniblog.ddns.net left intact