Submit a Ticket
Support Center » Knowledgebase » Web Server (Apache + IIS) » Redirect Traffic to SSL (https)

Redirect Traffic to SSL (https)

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, you will need to follow the steps below in order to do so:

CPANEL (.htaccess):


1. Login to your Cpanel.




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.




3. Find the .htaccess file and click Edit.




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 with your actual domain-name.




5. Click Save Changes.


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


WEBSITEPANEL (web.config):


1. Login to your WebsitePanel.




2. Click on the File Manager icon.




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




4. Click on the wwwroot folder.




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:

<system.webServer>
<rewrite>
<rules>
<rule name="HTTP/S to HTTPS Redirect" enabled="true" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny"> <add input="{SERVER_PORT_SECURE}" pattern="^0$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>




6. Click Save.


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

 This answer was helpful  This answer was not helpful
 Back