NODE249 // TOOLSLAB/002 · EXPERIMENTES

LEARN · HTTPS-REDIRECT

Redirect HTTP to HTTPS

Why your site should always redirect http:// to https:// and how to avoid mixed content.

WHAT IT IS

Even with HTTPS, someone may type your address without "https" or follow an old link. A permanent (301) redirect always takes them to the secure version. Mixed content is when a secure page loads resources over http://.

WHY IT MATTERS

Without a redirect, part of your traffic travels unencrypted. Mixed content makes the browser block scripts or images, or show warnings.

COMMON MISTAKES

EXAMPLE

server {
  listen 80;
  server_name example.com www.example.com;
  return 301 https://example.com$request_uri;
}

HOW WE CHECK IT