SEO best practice : HTTP to HTTPS
-
What's the best practice to switch from an all HTTP site to an all HTTPS site ?
No changes to the site structure, just a full site switch to SSL.
Right now, the site is reachable with HTTP and with HTTPS.http://crocodesign.be --> https://crocodesign.be
http://www.crocodesign.be --> https://crocodesign.be
https://www.crocodesign.be --> https://crocodesign.beCMS : Wordpress 3.9
Server type : Apache
Preferred method : .htaccess -
I wonder why Google's PhD engineers didn't post detailed info about this?.... But, I can probably understand it better from the Moz blog.
They also should have warned people that it would tank their adsense earnings.
-
We'll also be posting more info about this on the Moz blog later this month.
-
Oh ok...
This line ensures its a 301:
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
-
@Rafi : I want to explicity state in the .htaccess rule that a 301 must be used.
-
You can use any of the HTTP header checkers available online for the purpose or a desktop tool like Screaming Frog SEO Spider can also give you the HTTP header status codes for any URL.
Best regards,
Devanur Rafi
-
Thank you for your reply @TomRoberts
How can I make sure it's a 301 permanent redirect ? -
The above redirect structure you've proposed would work great. You're ensuring only one homepage version exists, making it the canonical, and all variations (which may also have previous links going to them and SEO value) are being redirected to pass on to the canonical version.
You can use your .htaccess file to force http to https by adding the following code:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]The first line turns on redirection capabilities. The second line checks to make sure the connection is not already https. The third rule will redirect users from their original location, to the same location but using HTTPS.
And also, in case you want to know how to make sure that the www. version of your site redirects to the non-www version, the code would be:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www.(.)$ [NC]
RewriteRule ^(.)$ https://%1/$1 [R=301,L]Hope this helps
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Redirect to http to https - Pros and Cons
Hi, I know its best practice to redirect a website from http to https, instead of having many entry point to your website. When a website has been running for a long time on http and https, what are the SEO Pros and Cons of implementing a redirect from Http to Https?
Technical SEO | | FreddyKgapza1 -
Breadcrumbs on Mobile How important are they for SEO?
Due to Poor unsightly look of breadcrumbs and the space it takes up above the fold we only employ breadcrumbs on our desktop version. Breadcrumbs are hidden from view on mobile version. However as mobile first indexing is now in play what technical SEO impacts will this have? one thing that comes to mind is crawling deeper pages where breadcrumbs made them accessible in less than 3 link clicks? But i am unsure now of the impacts of not having breadcrumbs visible for mobile version of our site.
Technical SEO | | oceanstorm0 -
Switching to HTTPS
Hey Moz Community! I am about to switch my website from http to https. I am wondering if I need to create a 301 redirect of every single page on my site, from the http address to the https url? Or if setting one master that redirects all traffic to the https version. Obviously I am concerned about losing rankings by switching. Code for https redirect of all RewriteEngine On
Technical SEO | | SeanConroy
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]1 -
Proper 301 redirect code for http to https
I see lots of suggestions on the web for forwarding http to https. I've got several existing sites that want to take advantage of the SSL boost for SEO (however slight) and I don't want to lose SEO placements in the process. I can force all pages to be viewed through the SSL - that's no problem. But for SEO reasons, do I need to do a 301 redirect line of code for every page in the site to the new "https" version? Or is there a way to catch all with one line of code that Google, etc. will recognize & honor?
Technical SEO | | wcksmith10 -
How bad is it to have duplicate content across http:// and https:// versions of the site?
A lot of pages on our website are currently indexed on both their http:// and https:// URLs. I realise that this is a duplicate content problem, but how major an issue is this in practice? Also, am I right in saying that the best solution would be to use rel canonical tags to highlight the https pages as the canonical versions?
Technical SEO | | RG_SEO0 -
Switching to HTTPS from HTTP
Hi, I have switched my website from http to https but now I my facing a problem when I type URL with www ( e.g https://www.example.com) in browser that is working fine but when I type URL without www like https://example.com "This connection is untrusted" error is showing . All I want to is redirect https://example.com to https://www.example.com. Please let me know how can I redirect? Thanks
Technical SEO | | Alick3000 -
Is dash problem for seo?
My web site http://www.green-lotus-trekking.com is this problem for google search engine optimization? Some little percentage problem or totally I am in Confusion?
Technical SEO | | agsln0 -
Http VS https and google crawl and indexing ?
Is it true that https pages are not crawled and indexed by Google and other search engines as well as http pages?
Technical SEO | | sherohass0