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

# Redirect Traffic to SSL (https)

## Redirect traffic

If you have already purchased and configured a SSL certificate for your website and want to redirect all traffic to it [https://www.example.com](https://www.example.com), you will need to follow the steps below in order to do so:

### WordPress SSL Plugin:

If you are using WordPress you can use a plugin like: Really Simple SSL: 

The above plugin will help you use your SSL and configure your WordPress automatic redirects.

For other applications, please check with your application vendor if they have a ready plugin/module that you can use to use SSL and setup automatic redirects.

Other ways to handle this are outlined based on your control panel below:

### cPanel (via .htaccess):

1. Login to your cPanel.

![](https://tutorials.my-virtual-panel.com/articles/c7hVwDC.png)

2. Click on the **File Manager** icon and then enable **Show Hidden Files (dotfiles)**, from the Document Root drop-down tab you need to choose the domain you want to redirect to SSL.

![](https://tutorials.my-virtual-panel.com/articles/sQPrr99.png)

3. Find the **.htaccess** file and click **Edit**.

![](https://tutorials.my-virtual-panel.com/articles/foAgLmZ.png)

4. Add the following lines of code in the .htaccess:

`RewriteEngine On  
 RewriteCond %{SERVER\_PORT} 80  
 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]`

Change [https://www.example.com](https://www.example.com) with your actual domain-name.

![](https://tutorials.my-virtual-panel.com/articles/hMG0rcZ.png)

5. Click **Save** Changes.

![](https://tutorials.my-virtual-panel.com/articles//kP0ucrE.png)

Now when you type your website in the browser you will be redirect to the SSL link [https://www.example.com](https://www.example.com).

### SolidCP /WebsitePanel (via web.config method):

1. Login to your SolidCP /WebsitePanel.

![](https://tutorials.my-virtual-panel.com/articles/C1wHUrn.png)

2. Click on the **File Manager** icon.

![](https://tutorials.my-virtual-panel.com/articles/j1D5Gwg.png)

3. Choose the website for which you want to redirect the traffic to SSL.

![](https://tutorials.my-virtual-panel.com/articles/CLIntjJ.png)

4. Click on the **wwwroot** folder.

![](https://tutorials.my-virtual-panel.com/articles/xHdbnaX.png)

5. Edit the **web.config** file and copy/paste the following code between the and tags in your web.config file in your website root directory:

\`

\`

![](https://tutorials.my-virtual-panel.com/articles/Srrjigd.png)

6. Click **Save**.

![](https://tutorials.my-virtual-panel.com/articles/1atNsNg.png)

Now when you type your website in the browser you will be redirect to the SSL link [https://www.example.com](https://www.example.com).
