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. Technical SEO Issues
    4. How to change 302 redirect from http to https

    How to change 302 redirect from http to https

    Technical SEO Issues
    4 3 2.1k
    • 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.
    • davedon
      davedon last edited by

      Hi gang. Our site currently has a 302 redirect from the HTTP version of the homepage to the HTTPS version of the homepage. I understand this really should be changed to a 301 redirect but I'm having a little trouble figuring out exactly how this should be done.

      Some places on the internet are telling me I can edit our htaccess file to specify the type of redirect, however our htaccess file seems to be missing some of the information in theirs.

      Can anyone tell me what needs to be changed in the htaccess file - or if there's a simpler way to change the 302 to a 301? Many thanks 🙂

      htaccess:

      BEGIN WordPress

      RewriteEngine On

      RewriteBase /

      RewriteRule ^index.php$ - [L]

      RewriteCond %{REQUEST_FILENAME} !-f

      RewriteCond %{REQUEST_FILENAME} !-d

      RewriteRule . /index.php [L]

      END WordPress

      EXPIRES CACHING

      ExpiresActive On

      ExpiresByType image/jpg "access plus 6 months"

      ExpiresByType image/jpeg "access plus 6 months"

      ExpiresByType image/gif "access plus 6 months"

      ExpiresByType image/png "access plus 6 months"

      ExpiresByType text/css "access plus 10 days"

      ExpiresByType application/pdf "access plus 10 days"

      ExpiresByType application/x-shockwave-flash "access plus 10 days"

      ExpiresByType image/x-icon "access plus 6 months"

      ExpiresDefault "access plus 2 days"

      EXPIRES CACHING

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

        Hi Use the following

        `# Redirect all "not correct" domain to www with https
        
        # (is not important if comes with or without https):
        
        RewriteCond %{HTTP_HOST} !^www.example.co.uk$ [NC]
        
        RewriteRule ^(.*)$ https://www.example.co.uk/$1 [L,R=301]
        
        # Redirect all non-ssl to ssl.
        
        RewriteCond %{HTTPS} off
        
        RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R,L]` 
        
        
        davedon 1 Reply Last reply Reply Quote 1
        • MattRoney
          MattRoney last edited by

          Hi David! Did Ikkie's response do the trick? 🙂

          1 Reply Last reply Reply Quote 0
          • davedon
            davedon @Mustansar last edited by

            Oop hi Ikkie, thanks for responding and sorry I didn't. Been one of those weeks!

            When I tried this I got the following error: 'www.midlandnetworks.co.uk redirected you too many times.' Do I need to replace the first bit of my htaccess with that or just stick it on the end? Sticking on the end didn't seem too successful for me.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            • Http to https redirection issue
              effectdigital
              effectdigital
              0
              3
              257

            • Switched from and HTTPS to HTTP. My home page is facing a redirect issue from the http to https. Should I no index the HTTP or find the redirect and delete it? Thank you
              LandmarkRecovery2017
              LandmarkRecovery2017
              0
              3
              42

            • Our site recently switched from http to https. Do I still need to setup a redirect for the incoming links pointing to http?
              Andy.Drinkwater
              Andy.Drinkwater
              0
              5
              81

            • Do you still loose 15% of value of inbound links when you redirect your site from http to https (so all inbound links to http are being redirected to https version)?
              LoganRay
              LoganRay
              0
              5
              74

            • Changing a site from http to https
              Clickatell2
              Clickatell2
              0
              5
              710

            • Ideally should a 301 or 302 redirect be used from https://www.site.com to http://www.site.com? Is there a valid reason to use a 302 in this situation or would using a 301 have any negative impact on seo?
              Unity
              Unity
              0
              2
              317

            • 302 or 301 redirect to https ?
              Kotkov
              Kotkov
              0
              9
              33.6k

            • I have a site that has both http:// and https:// versions indexed, e.g. https://www.homepage.com/ and http://www.homepage.com/. How do I de-index the https// versions without losing the link juice that is going to the https://homepage.com/ pages?
              fthead9
              fthead9
              0
              3
              729

            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