Redirection to subfolder domains redirects to https://www.domain.com/domain.com

If you run multiple single-site WordPress installs in one hosting account, and your root .htaccess routes each domain to its own folder (for example):

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/domain/
RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^(.*)$ /domain/$1 [L]

Really Simple Security’s default HTTPS redirect can conflict with this setup and produce incorrect URLs such as:

https://www.domain.com/domain.com

To fix this, add domain-specific redirect rules to the root .htaccess; the file in the folder that contains all site folders. It probably looks something like this:

  • root folder, with root .htaccess
    • domain1
    • domain2

Add this before Really Simple Security’s redirect rules:

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

Replace domain.com and www.domain.com with your actual domains. Repeat for each site in the account.

Simple and Performant Security.


Easily improve site security with WordPress Hardening, Two-Factor Authentication (2FA), Login Protection, Vulnerability Detection and SSL certificate generation.