• I have a particular case to solve: a hosting plan having different domains, all pointing to the hosting root.
    Based on domain visited I directly redirect the traffic to subfolders with a .htaccess on the root folder.

    For basic websites it works for WordPress I have some problems: there’s a WP in the root and a WP in a subfolder. When I call “rootdomain.tld/wp-admin/” it replies the root WP, if I call “subfolderdomain.tld/wp-admin/” continues to reply the root WP instead of subfolder WP so I cannot access the backend of subfolder WP.

    The root .htaccess is like this

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?subfolderdomain.tld$ [NC]
    RewriteCond %{REQUEST_URI} !^/subfolderdomain/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /subfolderdomain/$1 [L]
    RewriteCond %{HTTP_HOST} ^(www.)?subfolderdomain.tld$ [NC]
    RewriteRule ^(/)?$ subfolderdomain/index.php [L]
    
    # 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>
    # END WordPress

    and the .htaccess in the subfolder is this

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

    The root WP has
    site_url: https://www.maindomain.tld
    home: https://www.maindomain.tld

    The subfolder WP has
    site_url: https://www.subfolderdomain.tld/subfolderdomain
    home: https://www.subfolderdomain.tld

    The root WP works normally (frontend and backend) while the subfolder WP frontend is ok but I cannot access its backend if I try to login via wp-login.php or wp-admin.

    Any suggestions?

Viewing 1 replies (of 1 total)
  • Did you solve your problem ?
    Try to call not subfolderdmain/admin, but real destination
    domain.tld/subfolder/admin

Viewing 1 replies (of 1 total)
  • The topic ‘WP in subfolder with domain on root’ is closed to new replies.