If you have a valid SSL certificate installed on your site and you would like to force customers to connect over SSL. If you don't already have an SSL certificate installed you can purchase one through your my.rapidweb account now. Having an SSL Certificate and enforcing it will result in a better search ranking from Google and will give your customers peace of mind.

First, you need to create a file called .htaccess in your public_html folder. (If a file called .htaccess already exists simply edit that one)

At the top of your file add the following:

RewriteCond %{HTTPS} off

RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Now simply save you .htaccess file and your website visitors should now be forced to connect over HTTPS and redirected to WWW.

Let me explain how this works

RewriteCond %{HTTPS} off

First, we check to see if the client is already connecting over HTTPS or not


RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301

If not we redirect them to HTTPS://


RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Now we make them use HTTPS://WWW.