• <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    </IfModule>
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    This is my htaccess file. I want to force https://www.domain.com for all requests. I already have set WP settings to www however both versions (www and non-www) are still rendered. The site has an SSL certificate and always renders as https.

    Can someone please advise me on how/where to change my htaccess rules to always render www?

Viewing 1 replies (of 1 total)
  • I have the following:

    RewriteCond %{HTTP_HOST} ^domain\.com$
    RewriteRule ^(.*)$ https://www\.domain\.com/$1 [R=301,L,NE]
    

    Replace it with your actual domain name. I would try placing it after the

    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

    Line.

    Hopefully that works.

Viewing 1 replies (of 1 total)
  • The topic ‘forcing www in htaccess’ is closed to new replies.