RewriteEngine on 

RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301]

# WordPress Defaults
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

This is what .htaccess look like for my wordpress site. I have not added SSl certificate to server and I want https to be redirected to http.

With above rule added, redirection is not really working .


Why has google indexed https version of my website? I do not want that.

Infact I am worried if that might lead to duplicate content penalty. Besides, I undoubtedly prefer to have one and only one link leading to posts on my website. Currently google has indexed http and https version of my posts.

How do I fix this?

Edit: As suggested, I would like to make it clear that I never used SSL and yet google has somehow indexed SSL version of the website. I am using openshift and it does not allow to upload custom SSL certificate for the custom domain.

openshift provides CName http://your-techchick.rhcloud.com and it is available both on http and https. but it should not be interfering with my custom domain I guess>

  • Are you saying that Google has indexed https://www.your-domain.com or https://your-account.rhcloud.com?
    – MrWhite
    Commented Oct 20, 2015 at 10:05
  • google has not indexed my https://yourtechchick.com but posts at https://yourtechchick.com. Commented Oct 20, 2015 at 10:58

2 Answers 2


A valid https connection is required for HTTPS to HTTP to work for a particular domain. Currently, since http://yourtechchick.com is not available via https:// with its own SSL certificate, make sure that any .htaccess redirect you are applying is for https://your-techchick.rhcloud.com.


Why has google indexed [an] https version of my website? I do not want that.

You have several ways to access the same content: http://your-techchick.rhcloud.com, https://your-techchick.rhcloud.com and http://yourtechchick.com (Note that OpenShift also adds HTTPS access to an alias domain even without SSL).

https://your-techchick.rhcloud.com, etc. will be crawled (to some extent) by Google. This is an essential part of how Google and other search engines find content and there isn't much you can do. While it may seem intuitive to assume that http://example.com and https://example.com lead to the same content, this assumption is not necessarily made by Google. Furthermore, Google seems to prefer https:// versions of content currently.

Using the rel=canonical link element or other methods should help prevent the the mirroring of content. You may also want to investigate Googles policies on removing outdated content.

To clear up a point of confusion, OpenShift apparently "translates" alias domains without an SSL certificate (e.g. http://www.example.com) so that they appear or are otherwise available as https:// (at least to browsers and googlebot). So https://www.example.com/url "just works" even if there is no SSL certificate for www.example.com.


Finally, you may wish to consider moving to a more traditional hosting platform, one that doesn't automatically provide URLs you can't really control easily. OpenShift is awesome in many ways, but for all the hoops that seem to come with Wordpress installations in particular, a little money (likely less than $20 a month on a shared platform) might be worth not having so many headaches.

  • Thank you for your response.It makes complete sense to me now. However, I am not sure if it still is because of your-techchick.rhcloud.com that my posts are available on yourtechchick.com/post-url . I expected them to be available on yourtechchick.com/post-url only since there is no SSL certificate for my custom domain.I mapped your-techchick.rhcloud.com to yourtechchick.com while setting up domain with DNS provider. Do I need to change something there in order to deal with this?Also, I already have yourtechchick.com as canconical url in my header.php. Commented Oct 21, 2015 at 12:14
  • 1
    I have updated my answer. No, the issue your experiencing is because OpenShift seems to automatically "translate" any request for example.com into something the browser can handle, even if no SSL certificate exists for www.example.com. I am not fully certain of the mechanisms, but I am still willing to suspect this relies on the SSL certificate for your-techchick.rhcloud.com. That said, this is all done on OpenShift's side, so your DNS provider couldn't help likely. Regarding canonical refs, excellent, just continue making sure they point to http:// not https://. =P Commented Oct 24, 2015 at 8:16

To redirect from HTTPS to HTTP, you need a HTTPS certificate for the domain. This is because the SSL/TLS 'handshake' has to happen before the rules in your .htaccess file are processed. The .htaccess rules are only processed after the secure connection is negotiated and if the secure connection does not happen, the request fails. SSL/TLS is a different protocol which encapsulates the HTTP traffic, it must happen first.

You are better off having nothing listening on port 443. Just disable it and have your server listen on port 80 only.

If your site used to be HTTPS and you no longer support the protocol, you might consider purchasing another certificate for a year and then redirecting to HTTP and adding canonical links to the head of each page, so that when you stop using HTTPS next time you don't have this same problem.

If you don't want to purchase a certificate you might try Cloudflare's free Universal SSL along with canonical HTTP links for a while, until the search results are updated to HTTP only.

If you never supported HTTPS on your site and you believe Google has somehow indexed it as HTTPS, then please post that as an edit to your question because that would be very strange problem and probably requires a different answer.

  • As suggested, I have mentioned it in my edit and it exactly is the problem that somehow google indexed the ssl version. Commented Oct 20, 2015 at 9:34

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.