• Hey,

    I got an ssl certificate for my http://www.domain.com and want to refer the domain.com to the www. version. I found some questions about this on the forum but not in combination with HTTPS.

    what i got now is

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} on
    RewriteRule .* – [E=WPR_SSL:-https]
    RewriteCond %{SERVER_PORT} ^443$
    RewriteRule .* – [E=WPR_SSL:-https]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* – [E=WPR_ENC:_gzip]
    RewriteCond %{REQUEST_METHOD} GET
    RewriteCond %{QUERY_STRING} =””
    RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC]
    RewriteCond %{REQUEST_URI} !^(.*/feed/?)$ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC]
    RewriteCond “%{DOCUMENT_ROOT}/home/tribevi2/domains/bv-oprichten.com/public_html/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}.html%{ENV:WPR_ENC}” -f
    RewriteRule .* “/home/tribevi2/domains/bv-oprichten.com/public_html/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}.html%{ENV:WPR_ENC}” [L]
    </IfModule>
    # END WP Rocket

    # BEGIN rlrssslReallySimpleSSL rsssl_version[2.2.12]
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    </IfModule>
    <IfModule mod_headers.c>
    Header always set Strict-Transport-Security ‘max-age=31536000’ env=HTTPS
    </IfModule>
    # END rlrssslReallySimpleSSL
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

Viewing 1 replies (of 1 total)
  • Hi,

    Why not just do;

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]

    or if you don’t need HTTPS redirect just do the first line;

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
Viewing 1 replies (of 1 total)
  • The topic ‘No www to www with HTTPS’ is closed to new replies.