.htaccess redirection issues

I installed the LetsEncrypt SSL successfully from my hosting.

Now when I type my website and press CTRL+Enter it gives me.

`This site can’t provide a secure connection

www[dot]topseokeywords[dot]com sent an invalid response.
Try:
Reloading the page
Learn more about this problem.
ERR_SSL_PROTOCOL_ERROR`

It should redirect from https://www.topseokeywords.com to https://topseokeywords.com

My .htaccess file is:

# BEGIN HTTPS Redirection Plugin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END HTTPS Redirection Plugin

# BEGIN rlrssslReallySimpleSSL rsssl_version[2.3.3]
# END rlrssslReallySimpleSSL
# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Same issue is with my other website. I am using Google Chrome, Win 10 with Win Defender

www.topseokeywords.com resolves to a CloudFlare IP, while topseokeywords.com doesn’t. Could that be the problem?

1 Like

If I disable the Cloudflare services (which is by default turned on from my hosting) will it resolve the issue? And can I turn it back later on?

I’m not exactly sure why it’s failing with a SSL protocol error on the CloudFlare-enabled domain. It’s worth noting that when CloudFlare is enabled, SSL is terminated on a CloudFlare server, so the protocol error you’re seeing is generated by CloudFlare, and not by your server. CloudFlare, however, allows you to enable SSL for their sites, and usually does so by default. Maybe your web host disabled that feature and you need to enable it somewhere in the control panel (either your web host’s or CloudFlare’s)?

1 Like

I think you’ve disabled CloudFlare now… Unfortunately, the DNS entry for www.topseokeywords.com is still pointing to CloudFlare, perhaps just temporary.

From my point of view, when using the “real” (i.e.: non-CloudFlare) IP address, I can see everything is working perfectly with OpenSSL.

1 Like

The trick worked.

CNAME | www.topseokeywords.com. | cloudflare-resolve-to.topseokeywords.com

I disabled and re-enabled it. It is working now. Can you please check at your end by opening topseokeywords and press CTRL+Enter

======UPDATE=====

It didn’t work after I tried opening it in different browser.

So I disabled the Cloudflare CNAME entry for www.

Now both websites are working.

Well, CloudFlare isn’t happy about your domain (www nor non-www):

osiris@desktop ~ $ openssl s_client -connect 104.28.12.28:443 -servername topseokeywords.com
CONNECTED(00000003)
139890005145232:error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error:s23_clnt.c:769:

But when connecting to your IP, thus bypassing CloudFlare, everything works like a charm.

1 Like

@Osiris Does this show any issues in my .htaccess or something else? I am asking just for my knowledge. Because website is working fine, I’m happy.

Don’t think so. The redirect works fine. (Although redirecting non-HTTPS www.~ to HTTPS www.~ to HTTPS non-www is rather cumbersome, but hey, it works :stuck_out_tongue:)

If you’ve disabled CloudFlare, it’s probably just a DNS caching issue.

1 Like

If you expose your real IP anyway, I think there is really no need to use Cloudflare.

Especially as Cloudflare is MITM-build-in.

Yes As i can see you have still above issue Ref: image

To Solve this you may update your .htaccess something like below..

RewriteEngine On
RewriteBase /

# Redirect www to non-www with HTTPS
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

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

Hope it help you

@nehakakar You're replying to a post from 2016. They probably figured it out. Or not. But please don't kick threads this old.

3 Likes