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
-
Best Nofollow Practice Facing +500 instances of affiliate links
Hi. I have a set of affiliate links on my website. That's 50 unique links in total. They are placed in a separate folder /go/, and are all nofollowed. My website has 100 pages. When doing a site audit I get a report with 50 affiliate links pr. page x100. That's a huge report. Is this really necessary? I can ofc. choose to ignore the automated reports, but I can't help but to think that there must be an easier way to keep track of it? Like, if Link 1-50 is located in /go/, they should automatically be nofollowed, regardless of where they are located on the root/sub domain. Bonus question: The format of the link is https://exampledomain.com/go/brandname I am wondering if I should add that "/" at the end of it. If yes, why? If no, why?
Technical SEO | | Dan-Louis0 -
What is the best practice for h1 titles for products inside categories? long tail or short tail?
Sorry for the title of this, but didn't know the best way to put it. I have a question with category naming for products, To keep things simple, I'll use shoes for this example. Say I have a category, running-shoes, so the url would be, site.com/running-shoes/ and inside this category I have purple-pumas so the url is site.com/running-shoes/purple-pumas/ And I have the title Purple Puma Running Shoes Is that ok, or should I just use the title Purple Pumas ? The breadcrumbs shows Home > Running Shoes > Purple Puma Running Shoes then and I wasn't sure if that would be too much? Or how about using another version of the keyword for the title, like Purple Puma Jogging sneakers? Any ideas? Thank you!
Technical SEO | | Deacyde0 -
Which URL do I request Google News inclusion for: the http or the non-http?
In Google WMT/Search Console, I've marked the non-www. version of my site as the preferred. But I haven't run into a choice between http:// and non-http:// before. Should I choose the one listed at the top, which is the non-http (AND the non-www) version? Thanks! Unknown.png
Technical SEO | | christyrobinson1 -
Http:// to https:// 301 or 302 redirect
I've read over the Q & A in the Community, but am wondering the reasoning behind this issue. I know - 301's are permanent and pass links, and 302s are temporary (due to cache) and don't pass links. But, I've run across two sites now that 302 redirect http:// to https://. Is there a valid reason behind this? From my POV and research, the redirect should 301 if it's permanent, but is there a larger issue I am missing?
Technical SEO | | FOTF_DigitalMarketing1 -
Mobile SEO for mobile site
Hey there! I own a desktop website and just now finishe building a mobile site ( not a responsive design one) and I wish to start ranking my site on mobile serch result page. due to the automatic redirection from desktop website to the mobile site im confused: where should link to in order to SEO my mobile site? should i link to domin.com and assume the link juice is passing on? or should i link to m.domim.com?
Technical SEO | | logophone0 -
SEO for mobile
Hey everyone! I had just finished building my first mobile website and i wanna focus on SEO for mobile search. Now, since there is a redirection once a visitor enter to the web domain to the mobile site automatically (e.g. sample.com to m.sample.com). Question is: Where should i refer my back links to to improve my ranking on mobile result page? Would love for some help..
Technical SEO | | Tit0 -
Pager + SEO - Is it possible?
Hi, I am having this issue. I know that pager are not friends with SEO, but I want to know which is the best to do in this situations. for example, I work in a news company, and I have a lot of news pages that are very extensive so I use a pager. Well here I have the problem. suppose that the url is www.mysite.com/news/id/here-comes-the-title When you enter that URL you are viewing the first page that has this meta: title keywords description Now, the problem comes when the user goes to the page 2 of this news article. What I shall do? 1- Change the url to www.mysite.com/news/id/here-comes-the-title-PAGE2 www.mysite.com/news/PAGE2-id/here-comes-the-title www.mysite.com/news/id/PAGE2/here-comes-the-title 2- in the page 2,3,4,5 ... add a meta robot noindex? In the option 2 I think that I am loosing the opportunity to index the body of my article. Is this correct? Thanks
Technical SEO | | informatica8100 -
H-tags and Page Name best practice
For the past few months I've been working on a new site launch, but have been left with a couple of annoyances from my predecessor.. I've got a couple of questions about best practise (and if it's worth changing now). For reference, a good example page is http://polestars.net/hen-party/life-drawing-hen-party/ H-tags The (external) web designer has insisted that wrapping the logo in an H1 tag (with the same branded H1 text on every page), and using an H2 for the actual title of the page is fine. I really don't believe him, but at the same time, feel like maybe google is smart enough to discern the theme of a page in this structure. Is it worth having this changed so that the actual title is the first H1? Page naming convention Another annoyance that I've been left with is the fact that every product page is named the same "burlesque hen party", "life drawing hen party", "whatever hen party"... It looks a little weird, but my real concern is that as we now have 60 "hen party" links in the navigation menu of a bunch of our pages, this may be seen as keyword stuffing - is this a real concern, or am I overthinking it?
Technical SEO | | AlecPR0