Error page working only for HTTPS

Hi, There.

I have a free SSL on my page, add a redirect from http to https(working as a charm), but I only get my custom error page when I try a https//: addresses.

E.g.
https://myPage.com/fileDoesNotExist = my custom error page
http://myPage.com/fileDoesNotExist = InfinityFree error page

My .htaccess file:


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:CF-Visitor} !{"scheme":"https"}
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

ErrorDocument 403 https://myPage.com/indexErr.html
ErrorDocument 404 https://myPage.com/indexErr.html
ErrorDocument 500 https://myPage.com/indexErr.html

Also add my error page on cPanel for all erros. Still not working.

PS: myPage is used as an example

Thank You in Advance

Put your ErrorDocuments before the redirect and then see.

1 Like

Thank you, @wackyblackie. I already tried that and did not work.

Tried once again just in case…

1 Like

I checked your site (without https) with a bad URL, and I got redirected to a custom error page on HTTPS. Which is what I would expect given the .htaccess codes, so it would seem all is good.

Could you please try again in Private Browsing/Incognito mode to rule out any caching issues on your end?

1 Like

You wont believe me, but I tried many times and on different Browsers.

This time it actually worked.

It maybe have taken some time to accept/replicate the configurations. IDK…

Thank You for your time

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.