1

I made a couple of edits to my htaccess file today to redirect. htaccess now has this:

Redirect 301 / https://www.newsite.org

If I type my domain into the address bar, it redirects properly. However, if I search for my site on Google and click on it, I receive a ERR_SSL_PROTOCOL_ERROR error. This only happens in Chrome and Safari, the redirect works in Firefox. I have an SSL certificate through my hosting provider, no changes have been made to the SSL certificate, it isn't expired, so I'm not sure why I am receiving this error 1. now 2. only via Google search results.

I didn't make any change to SSL, didn't move the site, just a redirect. Can someone suggest what I might have done wrong or help?

1 Answers1

2
Redirect 301 / https://www.newsite.org

You are missing a trailing slash on the end of the target URL (after the hostname). It should be like this:

Redirect 301 / https://www.newsite.org/

The Redirect directive is prefix-matching. Everything after the match (a single slash in this case) is copied onto the end of the target URL.

(The Redirect directive is for redirecting entire branches of URLs - or entire sites - not just individual URLs.)

So, without the trailing slash on the target, when you request a URL like example.com/foo it will redirect to https://www.newsite.orgfoo , which will likely result in domain resolution errors, SSL errors, etc. (The malformed redirect should be obvious by looking at the URL in the browser's address bar.)

With the trailing slash then foo is copied onto the end of https://www.newsite.org/ resulting in https://www.newsite.org/foo - all good.

Requests for the document root exampel.com/ "work" because it's simply a redirect to https://www.newsite.org. (Although even in this case, the browser is having to "fix" the target URL by appending a slash after the hostname.)

  1. only via Google search results

It's quite likely the URL you are clicking on is not just example.com/.

  1. now

You seem to be looking just at the "SSL Certificate" aspect, but it's probably a completely different domain.

301 (permanent) redirects are also persistently cached by the browser. So, you might also be seeing a mix of old (cached) redirects/responses.

This only happens in Chrome and Safari, the redirect works in Firefox.

I don't believe Firefox is capable of "correcting" a request for something like https://www.newsite.orgfoo, so this is more likely to be a difference in caching. (?)

TIP: Test with 302 (temporary) redirects to avoid potential caching issues.


Reference:

MrWhite
  • 43,224
  • 4
  • 50
  • 90