Title: About setting up SSL
Last modified: May 1, 2018

---

# About setting up SSL

 *  [Jack Sarlo](https://wordpress.org/support/users/redhalls/)
 * (@redhalls)
 * [8 years ago](https://wordpress.org/support/topic/about-setting-up-ssl/)
 * Hi,
 * I purchased ssl from my host (hostgator) and it’s paid and setup.
 * I went through my wordpress dashboard >> settings and changed the urls to https.
   I also modified any plugins to use https.
 * My question is I want to redirect everyone to [https://www](https://www) version(
   not the non ww) should I add these to .htaccess?
 *     ```
       RewriteCond %{HTTPS} !=on
       RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=301,L]
   
       RewriteCond %{HTTP_HOST} ^mydomain.com$
       RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
       ```
   
 * Thanks

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10241007)
 * If you are on an Apache server, then yes. One small correction, change the last
   line’s `http:` to `https:`. Might as well avoid another rewrite.
 *  Thread Starter [Jack Sarlo](https://wordpress.org/support/users/redhalls/)
 * (@redhalls)
 * [8 years ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10243706)
 * Thank You.
 *  Thread Starter [Jack Sarlo](https://wordpress.org/support/users/redhalls/)
 * (@redhalls)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10287216)
 * I actually forgot one thing.
 * What code do I use to redirect from [https://website.com](https://website.com)
   to [https://www.website.com](https://www.website.com) and do I add it after this
   code or instead of some parts of it:
 *     ```
       RewriteCond %{HTTPS} !=on
       RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=301,L]
   
       RewriteCond %{HTTP_HOST} ^mydomain.com$
       RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
       ```
   
 * Do I use this one instead of the other one:
 *     ```
       RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
       RewriteCond %{HTTPS} off
       RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
       RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L,NE]
       ```
   
 * Thanks
    -  This reply was modified 7 years, 12 months ago by [Jack Sarlo](https://wordpress.org/support/users/redhalls/).
    -  This reply was modified 7 years, 12 months ago by [Jack Sarlo](https://wordpress.org/support/users/redhalls/).
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10291545)
 * I’d use the first set. The second part of the first rewrites mydomain.com to 
   [http://www.mydomain.com](http://www.mydomain.com). Change the last line to use`
   https` though, then the order doesn’t matter too much as long as it’s before 
   the WP rewrites.
 *  Thread Starter [Jack Sarlo](https://wordpress.org/support/users/redhalls/)
 * (@redhalls)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10291715)
 * alright but when I go to [https://mysite.com](https://mysite.com) it’s showing
   certificate error, it’s not redirecting to [https://www.mysite.com](https://www.mysite.com).
 * The ssl I purchased is on [https://www.mysite.com](https://www.mysite.com)
 * This is the site: [https://straighttalkperfectsalesletter.com/](https://straighttalkperfectsalesletter.com/)
 * Thanks
    -  This reply was modified 7 years, 12 months ago by [Jack Sarlo](https://wordpress.org/support/users/redhalls/).
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10295870)
 * I see. The browser triggers the warning before the redirect is able to take place.
   If one allowed an exception, the redirect then does indeed take place, so your
   rule is correct, but it’s too little too late.
 * A site I have also has a www common name certificate. Requesting without the 
   www does not trigger the browser warning. Unfortunately, I do not know the specifics
   of the certificate, the host managed obtaining the certificate for us. Some how
   it works, but I could not tell you why. The site does not even have a no-www 
   to www redirect .htaccess rule, that redirect is done by WP because the siteurl
   option has www. So somehow a non www request is allowed through despite the certificate’s
   common name having the www.
 * Perhaps your host could suggest what the problem may be? This issue is a little
   outside of WP, as it happens before WP is even involved.
 *  Thread Starter [Jack Sarlo](https://wordpress.org/support/users/redhalls/)
 * (@redhalls)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10295998)
 * I’ll contact them, the 24th time I think :).
 * Thanks for helping.
 *  Thread Starter [Jack Sarlo](https://wordpress.org/support/users/redhalls/)
 * (@redhalls)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10325209)
 * The basically said I have to buy ssl for the non www too.
 * I just figured a positive ssl from namecheap covers both www and non www. About
   $70 + $50 installation for 7 websites instead of $400 with a multi site ssl.
 * This code will redirect all to https:
 *     ```
       RewriteCond %{HTTPS} !=on [OR]
       RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [NC]
       RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
       ```
   

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘About setting up SSL’ is closed to new replies.

## Tags

 * [SSL](https://wordpress.org/support/topic-tag/ssl/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [Jack Sarlo](https://wordpress.org/support/users/redhalls/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/about-setting-up-ssl/#post-10325209)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
