Skip to main content

Verify HTTPS Redirect

Learning Focus

By the end of this lesson you will know how to verify that HTTP-to-HTTPS redirects are working correctly.

Testing the Redirect

# Test from the command line
curl -sI http://example.com | head -5

# Expected output:
# HTTP/1.1 301 Moved Permanently
# Location: https://example.com/

What to Check

TestExpected ResultMeaning
curl -sI http://example.com301 redirect to HTTPS✅ Working
curl -sI https://example.com200 OK✅ HTTPS working
Above returns 200 on HTTPNo redirect active❌ Enable "Always Use HTTPS"

Where Redirects Can Be Configured

  1. Cloudflare → "Always Use HTTPS" (easiest)
  2. OpenLiteSpeed → Listener redirect rules
  3. .htaccess → RewriteRule (per-site)
info

If "Always Use HTTPS" is enabled in Cloudflare, you do not need server-side redirect rules. They are redundant.

Key Takeaways

  • Verify with curl -sI http://example.com that a 301 redirect is returned.
  • Cloudflare's "Always Use HTTPS" is the simplest redirect method.
  • Do not configure redundant redirects in both Cloudflare and the server.

What's Next