How do I redirect from http to https on infinityfree free ssl certificates?

Website: https://homebase.rf.gd

Recently, I requested a new ssl certificate. HTTPS does work, but if you type in http, it won’t redirect to the https one. I am using the InfinityFree Free SSL certificates.
I tried cloudflare recently, but it says I need to have a top private domain (www.example.com) not (.rf.gd)


Is there another way I can redirect to HTTPS

Add this to .htaccess:-

image

Thank you, but I am getting an error message saying:

500 Error, please check your php script / enable display_errors in your cpanel

Also, my code is:

#Redirect to https

RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]

RewriteCond %{HTTP:X-Forwarded-Proto} =“”

RewriteRule (.*) https://%{(HTTP HOST}%{REQUEST URI} [R=301,L]

Header always set Content-Security-Policy “upgrade-insecure-requests;”

Just add

php_value display_errors On

to .htaccess will do

where do i add it?

At the very beginning of .htaccess

before here: <IfModule mod_rewrite.c>

yes

here’s the code:

php_value
display_errors
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteRule (.*) https://%{(HTTP HOST}%{REQUEST URI} [R=301,L]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>

still says 500 Error, please check your php script / enable display_errors in your cpanel

image

1 Like

arrgh. same error here’s the code i entered in /htdocs/.htaccess

php_value display_errors On

#Redirect to https
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteRule (.*) https://%{(HTTP HOST}%{REQUEST URI} [R=301,L]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>

I dun see the error. Can you clr your browser cache?

thanks it helped. I made a few edits to the code:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
1 Like

Cool

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