---
title: "Force a Secure Connection (SSL) Using .htaccess in Cloud Sites"
source: "https://docs.nexcess.com/hosting/cloud-sites/website-management/ssl/force-a-secure-connection-ssl-using-htaccess-in-cloud-sites/"
description: "Ensure all visitors access the secure (https) site, even if they enter http in the URL, for Cloud Sites with SSL. Edit the .htaccess file to achieve this."
vertical: "Hosting"
date: "2024-03-04"
last_modified: "2026-07-02"
---

# Force a Secure Connection (SSL) Using .htaccess in Cloud Sites

If your [Cloud Sites uses an SSL](https://www.liquidweb.com/help-docs/installing-an-ssl-certificate-in-cloud-sites/), you can make everyone visit the https (secure) site, even if they type “http” in the URL. The way to do this is by editing your *.htaccess* file. [Read about .htaccess ](https://docs.nexcess.com/hosting/security/what-is-an-htaccess-file/)before trying the rule samples below.

| ### **Note:** |
|---|
| The code provided below is only an example. Your specific website may require different code. As outlined in our [Terms of Service](https://www.liquidweb.com/policies/terms-of-service/) and [Cloud Sites Spheres of Support Expectations](https://www.liquidweb.com/help-docs/cloud-sites-spheres-of-support-expectations/), we are unable to troubleshoot code issues. We recommend speaking with your developer before implementing any scripts. |

Remember to replace “YOURDOMAIN” with your actual domain name (site URL).

```
#Force SSL on entire site
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteRule ^(.*)$ https://YOURDOMAIN/$1 [R,L]
```
