> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Redirecting visitors to SSL connections

> Learn how to set up your website to always redirect visitors to secure HTTPS connections, even if they type a non-secure HTTP URL in their browser.

This article demonstrates how to redirect users to secure (*https\://*) web site connections, even if they type a non-secure URL (*http\://*) in their web browser. This article applies to servers using Apache or Apache-compatible web servers (such as LiteSpeed).

<Note>
  This article assumes that you already have a valid, functioning SSL certificate on your web site.
</Note>

## Redirecting users to SSL-enabled connections

You may want to ensure that visitors to your web site always use a secure connection. To do this, you can use rewrite rules in a custom *.htaccess* file.

<Warning>
  **Important**

  If you are using WordPress, you can enforce SSL-enabled connections from the WordPress administration dashboard instead. For information about how to do this, please see [Configuring WordPress to always use SSL](/docs/configuring-wordpress-to-always-use-ssl).
</Warning>

If you use the rewrite rules in an *.htaccess* file in the web site's root directory, all requests will be redirected to HTTPS connections. Alternatively, you can modify the rewrite rules in a specific directory's *.htaccess* file to limit redirection to files in that directory.

Add the following lines to the desired .*htaccess* file to redirect users from a non-secure URL (*http\://*) to a secure URL (*https\://*).

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

## Related articles

* [Introduction to SSL](/docs/introduction-to-ssl)

* [Using .htaccess files](/docs/using-htaccess-files)

* [Redirecting users to SSL connections in Plesk](/docs/redirecting-users-to-ssl-connections-in-plesk)
