The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. White Hat / Black Hat SEO
    4. Forcing Entire site to HTTPS

    Forcing Entire site to HTTPS

    White Hat / Black Hat SEO
    4 2 122
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • joony
      joony last edited by

      We have a Wordpress site and hope to force everything to HTTPS.

      1. We change the site name (in wordpress settings) to https://mydomain.com
      2. In the htaccess code = http://moz.com/blog/htaccess-file-snippets-for-seos
      3. Ensure we are using HTTPS version of the site.

      • RewriteCond %{HTTPS} !on
      • RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

      but some blogs http://stackoverflow.com/questions/19168489/https-force-redirect-not-working-in-wordpress say

      • RewriteCond %{HTTPS} off
      • RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

      Which one is right? 🙂 and are we missing anything?

      1 Reply Last reply Reply Quote 0
      • MickEdwards
        MickEdwards last edited by

        It looks like you should be going for

        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

        This is saying that the condition is off - so non HTTPS URL calls then have the rewrite rule to switch to HTTPS

        RewriteCond %{HTTPS} on  - is looking for HTTPS URL calls, so the opposite.

        Test it and see what happens.  You can always restore your backup .htaccess if you hit problems.  Please be aware that your server set-up may mean this doesn't work and you'll have to delve deeper.

        joony 1 Reply Last reply Reply Quote 0
        • joony
          joony @MickEdwards last edited by

          Thanks for the reply Mick,

          so if we are implementing HTTPS for the first time,

          "RewriteCond %{HTTPS} on " is the right rule, right?

          Thanks in advance for your time 🙂

          MickEdwards 1 Reply Last reply Reply Quote 0
          • MickEdwards
            MickEdwards @joony last edited by

            No it isn't.  As I said -

            RewriteCond %{HTTPS} off
            RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

            This is saying that the condition is off - so non HTTPS URL calls then have the rewrite rule to switch to HTTPS.

            1 Reply Last reply Reply Quote 1
            • 1 / 1
            • First post
              Last post
            • Consolidating small sites into one big site
              calentador2019
              calentador2019
              0
              5
              54

            • We have a site with a lot of international traffic, can we split the site some way?
              gfiorelli1
              gfiorelli1
              0
              2
              57

            • Should I 301 redirect my old site are just add a link to my new site
              Christy-Correll
              Christy-Correll
              0
              7
              147

            • Do I lose link juice if I have a https site and someone links to me using http instead?
              TheWebMastercom
              TheWebMastercom
              0
              5
              951

            • Multiple sites in the same niche (Should we redirect these to our Main Site)
              RyanPurkey
              RyanPurkey
              0
              4
              122

            • What could go wrong? SEO on mobile site is different than desktop site.
              bridget.randolph
              bridget.randolph
              0
              3
              570

            • WP Datar site shady linking to my site
              Andy.Drinkwater
              Andy.Drinkwater
              0
              7
              165

            • Is this a 'real site' or a spam site for backlinks
              LynnPatchett
              LynnPatchett
              0
              8
              266

            Get started with Moz Pro!

            Unlock the power of advanced SEO tools and data-driven insights.

            Start my free trial
            Products
            • Moz Pro
            • Moz Local
            • Moz API
            • Moz Data
            • STAT
            • Product Updates
            Moz Solutions
            • SMB Solutions
            • Agency Solutions
            • Enterprise Solutions
            • Digital Marketers
            Free SEO Tools
            • Domain Authority Checker
            • Link Explorer
            • Keyword Explorer
            • Competitive Research
            • Brand Authority Checker
            • Local Citation Checker
            • MozBar Extension
            • MozCast
            Resources
            • Blog
            • SEO Learning Center
            • Help Hub
            • Beginner's Guide to SEO
            • How-to Guides
            • Moz Academy
            • API Docs
            About Moz
            • About
            • Team
            • Careers
            • Contact
            Why Moz
            • Case Studies
            • Testimonials
            Get Involved
            • Become an Affiliate
            • MozCon
            • Webinars
            • Practical Marketer Series
            • MozPod
            Connect with us

            Contact the Help team

            Join our newsletter
            Moz logo
            © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
            • Accessibility
            • Terms of Use
            • Privacy