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
            • How to do 301 from an old/closed site to a new site?
              seoelevated
              seoelevated
              0
              4
              94

            • Hacked site vs No site
              jessew
              jessew
              0
              3
              106

            • Somebody took an article from my site and posted it on there own site but gave it credit back to my site is this duplicate content?
              edward-may
              edward-may
              0
              6
              233

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

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

            • competitor sites link to a considerable amount of irrelevant sites/nonsense sites that seem to score high with regard to domain authority
              eranariel
              eranariel
              0
              3
              221

            • Why does my entire site show duplicate page titles for every single page? I have palced a canonical tag on index page will this correct the problem?
              Francisco_Meza
              Francisco_Meza
              0
              3
              471

            • Client Selling Links On One Site Hurt Their Other Site?
              RyanKent
              RyanKent
              0
              4
              756

            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