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
-
Our clients Magento 2 site has lots of obsolete categories. Advice on SEO best practice for setting server level redirects so I can delete them?
Our client's Magento website has been running for at least a decade, so has a lot of old legacy categories for Brands they no longer carry. We're looking to trim down the amount of unnecessary URL Redirects in Magento, so my question is: Is there a way that is SEO efficient to setup permanent redirects at a server level (nginx) that Google will crawl to allow us at some point to delete the categories and Magento URL Redirects? If this is a good practice can you at some point then delete the server redirects as google has marked them as permanent?
Technical SEO | | WillyGx0 -
Http -> https redirections / 301 the right way
Dear mozers, Thank you for your time reading the message and wanting to help! So, we have moved our WordPress to https and redirected all the content successfully via htaccess file. We used a simple 301 redirect plugin, which we are using to redirect old URLs to the new ones. The problem today is, the redirections in the plugin are not working for http version. Here is an example: htaccess redirect: http --> https Plugin redirect domain.com/old --> domain.com/new but, the url http://domain.com/old is not redirecting to https://domain.com/new while https://domain.com/old does redirects to https://domain.com/new What can you suggest as a solution? Thank you in advance! P.S. I don't think having 2 redirects for each version of the URL is the smartest solution Best wishes, Dusan
Technical SEO | | Chemometec0 -
Homepage Not Ranking in Google - How long do old (not current) bad SEO practices exert influence?
I'm trying to get to the bottom of a problem I have with the Google ranking for mauiactivities.com - it's far below what I would hope for. My research so far has uncovered the following, and any advice on where to go from here would be appreciated. _Edit:_No problems with Bing or Yahoo - the site is #1 for primary key word 'maui activities' 1. Running a site:http://www.mauiactivities.com search in Google reveals that the homepage doesn't rank. At all. I looked through the 17 pages of results and can't spot it. Edit: I have now, after fresh checks after submitting the homepage through Search Console, found it at #1 - still, the following applies ... 2. I've found that the domain (before it was purchased by my client in 2011) had some bad inbound links, specifically from scubamaui.com (no longer active). The links where white, on a white background. This web archive snapshot will reveal all. 3. Those bad links were 'cleaned up' (i.e. they don't show in the web archive) from 2014, and as mentioned above, the website is now 'down'. 4. Search Console doesn't have a manual penalty. 5. When I search for 'tropical divers maui' in Google I find www.mauiactivities.com is the 4th result. To me, this indicates a current relationship with the dead site (Tropical Divers Maui). No other term comes close to ranking to high for the homepage. So, to summarise - can the old, dead Tropical Divers Maui website still be affecting the Google ranking, and what would you suggest I do next?
Technical SEO | | jsherwin0 -
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 -
Best practice around removing large section of the website
We are looking at removing a large section of our website that is getting low/no traffic. My current thought of removing this would be to delete the pages and add 301 redirects to a similar page within the site that is not being deleted. This will be removing 400+ pages, does it this make sense? Or should we point them to the homepage? Finally should we do this in one batch or should we slowly remove the pages over the course of a couple weeks. Thanks - appreciate the help in understanding the best practice in terms of SEO.
Technical SEO | | webactive0 -
Image Height/Width attributes, how important are they and should a best practice site include this as std
Hi How important are the image height/width attributes and would you expect a best practice site to have them included ? I hear not having them can slow down a page load time is that correct ? Any other issues from not having them ? I know some re social sharing (i know bufferapp prefers images with h/w attributes to draw into their selection of image options when you post) Most importantly though would you expect them to be intrinsic to sites that have been designed according to best practice guidelines ? Thanks
Technical SEO | | Dan-Lawrence0 -
Http & https canonicalization issues
Howdyho I'm SEOing a daily deals site that mostly runs on https Versions. (only the home page is on http). I'm wondering what to do for canonicalization. IMO it would be easiest to run all pages on https. But the scarce resources I find are not so clear. For instance, this Youmoz blog post claims that https is only for humans, not for bots! That doesn't really apply anymore, right?
Technical SEO | | zeepartner0 -
Pintrest SEO
Has any testing been done to determine if Pintrest helps a website ranking?
Technical SEO | | StreetwiseReports0