404 pages Redirect rules

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

If you are running multiple single site WordPress websites in one hosting account, where you redirect to the correct domain using htaccess code like the example this:

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

the default Really Simple SSL redirect in combination with this code might cause a redirect that ends up like this:

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

To solve this, you have to add some lines to the .htaccess in your root folder. The root folder then is the folder where all folders are located with the subsites in it. It probably looks something like this:

  • root folder, with root .htaccess
    • domain1
    • domain2
RewriteCond %{HTTP_HOST} ^domain.com [NC] 
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]

 

Related Articles

2 Comments

  • Anan Mohammed

    look at the default Really Simple SSL lines where exactly? I am having this same problem but the instructions to solve it doesn’t seem to be very clear.

    • Rogier Lankhorst

      I’ve updated the article, so you don’t need these lines. Could you check if the current article is more clear? You should add those lines to the .htaccess folder in your root folder, where all subfolders/sumdomains are located.

Leave a Comment