Google HTTPS SEO (Nginx)

Sep 7, 2012   #google  #https  #nginx  #seo 

A couple of days ago, well, 5 to be precise, I moved this blog to a new server, new Nginx based stack. In the move, I decided to enforce secured HTTPS force all my services, including this blog. Privacy matters!

Surprisingly enough, I suddenly disappeared from Google at the very same time.

It appears to be linked to the HTTPS move. Disabling the systematic redirection to the secured protocol made it happy again.

However, I still want to be automatically moved to the secure version every time I log into the backend. All WordPress admin pages starts with ‘/wp-‘, it is then straight forward to make Nginx clever about security. Here is a nice snippet to put into the relevant ‘server’ section:

location /wp-
    {
      if ($ssl_protocol = "")
      {
          rewrite ^   https://$server_name$request_uri? permanent;
      }
    }

instead of only

if ($ssl_protocol = "")
    {
        rewrite ^   https://$server_name$request_uri? permanent;
    }