Redirect my WordPress website to HTTPS in cPanel hosting

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

Note: Several plug-ins are available for WordPress that can redirect your URL automatically after you have installed your SSL certificate. For help with WordPress plugins, see wp.org

Warning: These instructions do not apply to SSLs installed on Managed WordPress. The HTTPS redirect is automatically enabled after the SSL certificate install finishes on a Managed WordPress account.

  1. Log in to your WordPress admin panel.
  2. Click Settings and then General.
  3. Change your WordPress URL and Site URL from http://coolexample.com to https://coolexample.com(you will need to substitute your domain name for coolexample.com) and click Save Changes.
  4. Create a .htaccess file in your webroot or public_html folder.
  5. Insert the code listed below into your .htaccess file and save the file.
# BEGIN GD-SSL <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_USER_AGENT} ^(.+)$ RewriteCond %{SERVER_NAME} ^coolexample\.com$ [OR] RewriteCond %{SERVER_NAME} ^www\.coolexample\.com$ RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] Header add Strict-Transport-Security "max-age=300" </IfModule> # END GD-SSL # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress

More info


Oliko tästä artikkelista hyötyä?
Kiitoksia palautteestasi. Jos haluat puhua asiakaspalveluedustajan kanssa, käytä yllä näkyvää puhelinnumeroa tai chat-vaihtoehtoa.
Kiva, että meistä oli apua. Voimmeko tehdä jotain muuta?
Olen pahoillani asiasta. Kerro meille, mikä on epäselvää tai miksi ratkaisu ei toiminut oman ongelmasi kohdalla.