Welcome to UltratechHost Forum, Guest. Please take the time to register if you haven't, or click

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[-]
Tags
redirect http to https automatically

Redirect HTTP to HTTPS automatically
#1
If you have a secure certificate (SSL) on your website, you can automatically redirect visitors to the secured (HTTPS) version of your website to make sure their information is protected.

Linux/cPanel/WHM:

Using the following code in your htaccess file automatically redirects visitors to the HTTPS version of your site:


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


If you have an existing .htaccess file:
    Do not duplicate RewriteEngine On.
    Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already-existing RewriteEngine On.


Windows/Plesk:

Using the following code in your web.config file automatically redirects visitors to the HTTPS version of your site:


Code:
<configuration>
<system.webServer>
<rewrite>
   <rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>  
   </rules>
</rewrite>
</system.webServer>
</configuration>


If you have an existing web.config file:
    Ensure you have sections (i.e. opening and closing tags) for:
        system.webServer (which contains rewrite)
        rewrite (which contains rules)
        rules (which contains one or more rule sections)
    Insert any of those sections that do not exist.
    Insert the entire rule section, including match, conditions, and action, inside the rules section.



Dinesh Kumar Mohanty
Ultra Web Solutions®
Bhubaneswar, Odisha, India.

UltratechHost - Your One Stop Offshore & Onshore Hosting Provider
Server Locations : Netherlands, Germany, Russia, Singapore & USA
Service Offers: Shared hosting | Reseller hosting | Cloud server | Dedicated server | VPS Hosting



Forum Jump:


Users browsing this thread: 1 Guest(s)