OVHcloud Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

How to redirect http to https on a fully static web page


#1

Hello this is my first question I’m asking here.
Please advise if you think I can improve the question.

We’re hosting our web page with the OVH web hosting solution “Professional 2010”

And we activated https:// access via LetsEncrypt.

The page we have is a fully static page:

Is there any way I can achieve following:

Anybody who accesses our site with http://oursite should be redirected to https://oursite

If I had apache / nginx I would know how to do it, but I’m not sure how to achieve this with the OVH “Professional 2010” solution.

Any advice is welcome


#2

Hello,

You need to do this via the .htaccess file.

Basically put a htaccess file in the base of your directory with the following contents:

RewriteEngine on

 # force ssl
RewriteCond     %{SERVER_PORT} ^80$
RewriteRule     ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

this answer is wildly available on google you should google before you post :wink: