Automatic redirect to http, I want https for html css static site

My site url is: http://mr-tesla.epizy.com/
I have recently activate the ssl cirtificate for my site. But by default it redirect me to http version.
Like if I type mr-tesla.epizy .com then it redirects me to the http:// mr-tesla.epizy .com. But I want it to redirect it to https version by default. Like https:// mr-tesla.epizy .com.
I am using both wordpress and some static folder in my site directory. I know I can install the plugin Really Simple SSL plugin in wordpress. but what about raw html css site?

Hope I will find the solution asap.
Have a nice day!

just put this in the .htaccess file inside your htdocs folder.

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

at the top of .htaccess file?

whereever

it says, **do not edit this file. make a new .htaccess file to overwrite the rules.
but when I tried to create a new .htaccess file it shows this following errorinfinityfree .htaccess

You will have to create a .htaccess file inside your htdocs folder, and if mod_rewrite is not enabled there already, I also suggest adding in the beginning of the file RewriteEngine On.

6 Likes

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