Redirect HTTP to HTTPS and normalize on www. or non-www.

Discussion in 'Suggestions & Feedback' started by seismicmike, Sep 14, 2019.

  1. seismicmike

    seismicmike Professor Einstein

    Likes Received:
    I keep getting bounced back and forth between HTTP and HTTPS, which can be a little annoying when I've logged in as one and suddenly find myself in the other where I'm not logged in (because of the way sessions are handled.) If you're going to have HTTPS, it's probably best to redirect all traffic to HTTPS and also to standardize on whether your site uses www. or not. Not only will this improve user experience, but it'll boost your SEO score as well.

    You should be able to do this in your .htaccess if your server has mod rewrite enabled. Something like this should work:

    RewriteCond %{HTTP_HOST} scarletbuckeye\.com$ [NC,OR]
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^{REQUEST_URI} [L,R=301]

    You'll obviously want to test this in a development environment if at all possible before deploying anything to production.

Share This Page