• I have a unique situation where I had to set up a multisite at siteexample.com/wp. So what I’m trying to accomplish is that the subdirectories have to be developed first and then they will use an addon domain.

    So for example, siteexample.com/wp/firstsite becomes myfirstsite.com. And siteexample.com/wp/secondsite is still in development.

    My problem is that in order to get the domain to work, I have to edit the .htaccess. It gives me a 500 internal server error. But when the domain works, the subdirectories stop working and give me a 404 error. And when the subdirectories work, the domain stops working.

    This is the code that allows the subdirectories to work:
    RewriteEngine On
    RewriteBase /wp/
    RewriteRule ^index\.php$ – [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    And this is the code that allows the domain to work:
    RewriteEngine On
    RewriteBase /wp/
    RewriteRule ^index\.php$ – [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . /index.php [L]

    Is there a way that will allow both to work?

Viewing 1 replies (of 1 total)
  • I think I’d run WordPress from the web root first and then use the built-in mapping in WordPress multi-site to map the domain name once I’m up and running. Trying to do this via htaccess while running from a subdirectory is just too difficult when multi-site runs so well using its internal mapping.

    Here’s how to run WordPress from the root deomain while most of it is installed in a sub-directory https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory.

    The mapping is done by editing the ‘sites’ data from the Network dashboard. https://codex.wordpress.org/WordPress_Multisite_Domain_Mapping

    You may need to let your hosting control panel know about your extra addon domains but all your domains will point to the same IP address(es) used by the main domain.

Viewing 1 replies (of 1 total)

The topic ‘Subdirectory Domain Issue’ is closed to new replies.