Alex7
Alex7

Reputation: 560

Wordpress SSL issue for addon domains in htaccess

I have an wp installation on the main domain and a few addon domains which are unrelated. I installed really simple ssl plugin to handle all un-secure requests made by my site, but all the addon domains are affected and they require also ssl certificate.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^$ https://www.example.com/$1 [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# BEGIN rlrssslReallySimpleSSL rsssl_version[2.2.10]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

Without the Really simple ssl it works ok, but this part of the htaccess file affects all subdomains. Also i tried to add

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]

in the ssl conditions but now all addon domains are redirected to the main domain.

Upvotes: 0

Views: 116

Answers (1)

Michael Vermeulen
Michael Vermeulen

Reputation: 187

Try this .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /WORDPRESSROOT/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /WORDPRESSROOT/index.php [L]
</IfModule>

# END WordPress

# BEGIN rlrssslReallySimpleSSL rsssl_version[2.2.10]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

Change WORDPRESSROOT to the folder where your wordpress is located otherwise delete it and change it to /index.php

I also use Really Simple SSL but it only affects the folder where the .htaccess is located in. Otherwise try to move your website to /wordpress/ and redirect your site to your root folder.

Here's the documentation:

https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

EDIT: SAVE YOUR OLD .HTACCESS FIRST.

Upvotes: 1

Related Questions