Johnny Kermode
Johnny Kermode

Reputation: 75

WordPress Multisite SSL htaccess

I would like to redirect from non-https to https on my site and subdomains, but I'm having issues to solve it.

This is my setup:

www.domain.de
www.sub.domain.de
www.sub2.domain.de
www.sub3.domain.de

I can open all links by https and it works, but due duplicate content I would like to use https only.

RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://domain.de/$1 [R=301,L]

this is my htaccess so far... but it redirects the subdomains to the primary domain :(

any ideas?

Upvotes: 1

Views: 1835

Answers (2)

Croises
Croises

Reputation: 18671

You can use:

RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301] 

Upvotes: 1

Rochus Quastenit
Rochus Quastenit

Reputation: 13

You can use this pluging: https://wordpress.org/plugins/https-redirection/ It is a simpel way to do it, it redirect everything from HTTP to HTTPS.

Upvotes: 0

Related Questions