Switching to HTTPS - redirect question

Posted by seengee on Pro Webmasters See other posts from Pro Webmasters or by seengee
Published on 2014-08-15T09:40:55Z Indexed on 2014/08/18 16:45 UTC
Read the original article Hit count: 261

Filed under:
|
|
|

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?

© Pro Webmasters or respective owner

Related posts about seo

Related posts about php