# How to Set Up WordPress with SSL and HTTPS

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

<div class="wpb_text_column wpb_content_element " id="bkmrk-you-can-do-this-by-g"><div class="wpb_wrapper">- You can do this by going to **Settings** -&gt; **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]
    ```

</div></div><p class="callout info">Don’t forget to replace yoursite.com with your site URL.</p>

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';
```