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
-
What's best practice for cart pages?
i don't mean e-commerce site in general, but the actual cart page itself. What's best practice for the links that customers click to add products to the cart, and the cart page itself? Also, I use vanity URLs for my cart links which redirect to the actual cart page with the parameters applied. Should I use use 301 or 302 redirects for the links? Do I make the cart page's canonical tag point back to the store home page so that I'm not accruing link juice to a page that customers don't actually want to land on from search? I'm kinda surprised at the dearth of information out there on this, or maybe I'm not looking in the right places?
Technical SEO | | VM-Oz0 -
Does anyone know if an increase in 804 HTTPS errors will affect SEO rankings?
We recently moved our whole site over from HTTP to HTTPS and we went from having 106 keywords in the top 3 positions to 80 in just one week. The only thing that I can think of that caused the drop is the HTTPS changes to our site. Any input would be greatly appreciated.
Technical SEO | | SimonWorsfold0 -
Duplicate website with http & https
I have a website that only in a specific state in the USA we had to add a certificate for it to appear with https. my question is how to prevent from the website to be penalized on duplicate content with the http version on that specific state. please advise. thanks!
Technical SEO | | taly0 -
Which one is the best
Dear Seo experts, 1,5 month ago i started a informative website, i started it with a blank registrated domainname. Now 1 month further I've stacked the website with content and did much linkbuilding. Yesterday i ve bought a domainname from quarantine, its a domainname around 6 years old and has a bunch of backlinks already. What to do next? The first one has good content and good recent linkbuilding done. The second is a better domainname and is old and has old backlinks. And also higher PA and DA then the first one. Should i now go for the first one and 301 redirect the old domainname to the new one. Or should I do it the opposite way, 301 redirect the new website to the old domainname and move all content to the old domainname and try to move all linkbuilding to older domain? Hopefully anyone could give me a great answere, thank you so much! Kind regards, Menno
Technical SEO | | MennoO0 -
Redirection Impact on SEO
Need help urgently. There is the situation [This is how is it working now]: 1. Have a global landing page [say when user types in www.mysite.com - takes user to the global landing page: [www.mysite.com/global/en.html]](http://www.mysite.com/global/en.html] ) 2. Users from this landing page can select a country on his/her choice and get redirected say: [www.mysite.com/us/en.html] Would like to change the functionality as below: 1. When user types in www.mysite.com 1a. Would find the location of the request based on GEO IP and if the request is coming from North America region then would redirect the users to: www.mysite.com/us/en.html 1b. If the request is from any other location/region then it would continue to work as it is currently working: take the user to the global landing page: www.mysite.com/global/en.html Would this change have any negative impact or not found by search engines from SEO perspective? If it does then what are the impacts and if does not then why not. If it does then what is the best possible way to address this request. Appriciate your help. Thanks, Koushik Roy
Technical SEO | | KoushikRoy0 -
SEO - Localization
Hello Folks, I'm curious why my landing page is ranking at #1 on www.google.com.br ( brazil ). keyword: build wizard diablo 3. My lp is above well know domain names such as: wikia.com , blizzard.com , and also above a keyworded domain name: www.wizardbuilds.com/ Is just because my website is focus in brazilian google( .com.br ) or is because my landing page are better than the others( i don't think so)? Thanks.
Technical SEO | | augustos1 -
Is there an onsite seo api?
Im trying to find an api which I can intergrate with my database for onsite keyword checking. Does anyone know if there is one available on the market? thanks, Chris
Technical SEO | | seomasters0 -
What is consider best practice today for blocking admins from potentially getting indexed
What is consider best practice today for blocking pages, for instance xyz.com/admin pages, from getting indexed by the search engines or easily found. Do you recommend to still disallow it in the robots.txt file or is the robots.txt not the best place to notate your /admin location because of hackers and such? Is it better to hide the /admin with an obscure name, use the noidex tag on the page and don't list in the robots.txt file?
Technical SEO | | david-2179970