Have a Question?

Categories

How to Setup WordPress to Use SSL and HTTPS

You are here:
< All topics
Table of contents

If you are starting a new site and/or want to use HTTPS everywhere on your site, then you need to update your site URL.

  • You can do this by going to Settings -> General and updating your WordPress Address (URL) and Site Address (URL) address fields.
    Now if you’re adding SSL to your existing site, then you need to setup WordPress SSL redirect from HTTP to HTTPS.
  • You can do this by adding the following code in your .htaccess file:
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]

Don’t forget to replace yoursite.com with your site URL.

Open your wp-config.php and find the “That’s all, stop editing! Happy blogging.” row, and place above this code:

define('FORCE_SSL_ADMIN', true);
// in some setups HTTP_X_FORWARDED_PROTO might contain 
// a comma-separated list e.g. http,https
// so check for https existence
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
       $_SERVER['HTTPS']='on';
Was this article helpful?
0 out Of 5 Stars
5 Értékelés 0%
4 Értékelés 0%
3 Értékelés 0%
2 Értékelés 0%
1 Értékelés 0%
How can we correct this article?
Please submit the reason for your vote so that we can improve the article.