HTTP sends data in clear text. On public networks, attackers can read or change traffic, stealing logins, sessions, or personal data. This breaks customer trust and can violate compliance.
Forcing HTTPS encrypts all requests and responses. It protects cookies, forms, and APIs from interception and tampering. When every page is HTTPS, security is consistent across the whole site, including the admin and checkout.
# 1) HTTP should redirect to HTTPS with 301/308
curl -I http://yourstore.com
# Expect: HTTP/1.1 301/308 → Location: https://yourstore.com/
# 2) HTTPS should respond with 200 (valid certificate)
curl -I https://yourstore.com
# 3) Cookies should be marked Secure when set over HTTPS
# Check "Set-Cookie" headers (Secure; HttpOnly; SameSite)
curl -I https://yourstore.com | grep -i set-cookie
# Nginx
server {
listen 80;
server_name yourstore.com www.yourstore.com;
return 308 https://yourstore.com$request_uri;
}
# Apache (virtual host on :80)
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=308,L]
https:// to avoid mixed content (see MB-R029).# HTTP stays HTTP (no redirect)
$ curl -I http://yourstore.com
HTTP/1.1 200 OK
# Session cookies can leak over plaintext
# HTTP → HTTPS redirect + secure cookies
$ curl -I http://yourstore.com
HTTP/1.1 308 Permanent Redirect
Location: https://yourstore.com/
$ curl -I https://yourstore.com | grep -i set-cookie
Set-Cookie: PHPSESSID=...; Path=/; Secure; HttpOnly; SameSite=Lax