6

Following the recent Google announcements about improved ranking for sites running on https we have a number of clients asking about this. Is it safe to just 301 redirect all pages to their SSL equivalent, for example in a common PHP include file:

if($_SERVER['HTTPS']!="on"){
    $redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    header("Location:$redirect",true,301);
    exit();
}

Obviously I'm aware this is also possible within a .htaccess file but that cannot be modified in our case.

Obviously all internal links would be switched to https:// links but obviously we need to sort out incoming links from Google and elsewhere.

Is this a sound approach? Are there any other gotchas to be aware of?

3
  • 1
    As far as I'm aware the benefit is very minor to not noticeable, but everything counts right? sure, but also note that serving SSL also takes up more resources and depending on the traffic volume could actually slow down the site and well Google rewards for site speed. Commented Aug 15, 2014 at 10:03
  • 2
    Additionally internal links shouldn't need to use full protocol simply using /url-path/ without http or https ensures protocal compatibility later on. You can adopt this method on images, css and js. I also recommend using //domain.com/path/ for external http/https. These changes should be done way before SSL is enforced. Commented Aug 15, 2014 at 10:08
  • 1
    Be sure to test that your SSL certificate works with both www.domain.com and domain.com. If you ordered a SSL certificate for only domain.com users will get a browser warning for https://www.domain.com/. Commented Aug 15, 2014 at 20:27

2 Answers 2

2

Perfectly fine to 301 redirect all HTTP pages to their HTTPS equivalent. Either via httpd.conf on Apache servers, .htaccess rewrites or with a PHP include like your example. Any inbound links would pass about 97% of weight through a 301 redirect.

The best handling internally would be to not use the protocol for internal linkage so that compatibility is maximised sitewide with minimal intervention.

Https as a ranking signal is minimal, it is also not even categorically confirmed that there are site ranking benefits to be had by serving all URL's over https (this algorithm change affects on a per URL basis). That said however, John Mueller at Google recently confirmed that if you already have TLS on the domain, switching everything over to https ought to be a no-brainer (so more for the benefit of visitor trust than rankability).

This isn't straight forward of course for every site depending on the amount of embedded content it may have that is served on http within HTTPS pages (e.g. put an iframe, script, image, etc. that uses HTTP on a page that uses HTTPS). In any instances such as this, visitors could be seeing the red cross over the padlock or red/yellow browser warnings constantly on a site without each of these instances being taken care of and handled appropriately.

-2

It also depends on Competition. For example, I saw 2-3 sites from the 2th page in google.gr with https to come on 1th page.

As Google says it has affected 1% till now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.