• Resolved 2and8

    (@2and8)


    I have the latest version of wp in my root directory. I want to make it so the domain is always forced to display https://www. So even if someone just enters https://domain.com it will then force the www. too.

    In my wp-admin general settings both WordPress Address (URL) and Site Address (URL) is set as https://domain.com

    I’ve tried various .htaccess modifications from searching google but they always create redirect errors.

    Thanks for your time.

    • This topic was modified 5 years, 2 months ago by 2and8.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    First, you need to change the setting in settings->general to https://www.example.com.

    Then, edit your .htaccess file and add this at the top

    #Force https
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L,NE] 
    #Force www
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301,NC]

    Hi @2and8

    How about setting your WP address and Site URL to https://www.domain.com and then using a plugin like Really Simple SSL to force the SSL? You might also then set up a redirect at your host level.

    Thread Starter 2and8

    (@2and8)

    Well, you made that easy Steve. Thank you very, very much to both of you for the quick replies. Excellent support.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Force wp to add https://www. with .htaccess’ is closed to new replies.