Redirect HTTP to HTTPS automatically godaddy , host gador and hosting account
Redirect HTTP to HTTPS automatically
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.
How you redirect traffic depends on the type of hosting you have.
How you redirect traffic depends on the type of hosting you have.
Linux & cPanel
Linux-based accounts use.htaccess files to handle redirection.
Note: If you need to create a
Using the following code in your .htaccess file, you can use your control panel's file manager (Web & Classic / cPanel)..htaccess file automatically redirects visitors to the HTTPS version of your site: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
RewriteCondandRewriteRuleimmediately follow the already-existingRewriteEngine On.
Windows & Plesk
Windows-based accounts useweb.config files to handle redirection.
Note: If you need to create a
Using the following code in your web.config file, you can use your control panel's file manager (Web & Classic / Plesk).web.config file automatically redirects visitors to the HTTPS version of your site:<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 containsrewrite)rewrite(which containsrules)rules(which contains one or morerulesections)
- Insert the entire
rulesection, includingmatch,conditions, andaction, inside therulessection.Note: You're inserting therule(without an 's') inside therules(with an 's') section.
Comments
Post a Comment