• Hello,

    I have installed a multisite in a directory. (Ex : http://test.com/text/)

    Then I added some subsites in subdirectory mode
    http://test.com/test/website1/
    http://test.com/test/website2/
    Then I added another website with domaine mapping (no pluging)
    http://anotherwebsite.com

    Everything work except when I go to http://anotherwebsite.com on any page except the home page. It give me 500 error. (Take note http://anotherwebsite.com/wp-admin is working)

    The error lie in the htaccess. The RewriteBase url dosent work with this subsite configuration.

    RewriteEngine On
    RewriteBase /test/ –> need to be RewriteBase / to make it work.

    Howerever, if I make that change all others websites stop working.

    I have try to make some changes
    in wp-config
    define(‘PATH_CURRENT_SITE’, ‘/test/’); for define(‘PATH_CURRENT_SITE’, ‘/’);
    in the db
    wp_blogs, wp_site, wp_#_options switched back and forth between “/” and “/test/”

    But nothing work. I think I need to rewrite my htaccess to make wordpress undestand my rewrite base is /test/ everywhere except for http://anotherwebsite.com.

    At this point, I dont know how I can do that.

    Any help?

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi.

    I read that Apache 2.4 supports if and else. So something like the code below could work I guess if you have that version. Just remember to NOT change anything between “# BEGIN WordPress” and “# END WordPress” because the changes will be lost on WP update.

    <If “%{HTTP_HOST} == ‘anotherwebsite.com'”>
    RewriteEngine On
    RewriteBase /test/
    ………….
    ……………
    …………….
    </If>
    <Else>
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    ………….
    ……………
    …………….
    # END WordPress
    </Else>

    Thread Starter ideacom

    (@ideacom)

    Hello, im running apache 2.4+.

    Your code is working for simple redirection like
    <If “%{HTTP_HOST} == ‘test.com'”>
    RewriteRule / “http://www.google.com&#8221;
    <If>
    <If “%{HTTP_HOST} != ‘test.com'”>
    RewriteRule / “http://www.hotmail.com&#8221;
    <If>

    But, if I use “if” with wordpress code in it, it dosent work anymore :
    <If “%{HTTP_HOST} != ‘test.com'”>
    wordpress code here
    </If>
    <If “%{HTTP_HOST} != ‘test.com'”>
    wordpress code here
    </If>

    I made some test and as soon as I use <If “%{HTTP_HOST} != ‘test.com'”> everything crash except home page.

    I think there is some redirect at work we dont know of which prevent the use of this method.

    Another idea then. Maybe you can make http://example.com/example/ to be http://example.example.com/ and avoid using subfolder installation 🙂

    Thread Starter ideacom

    (@ideacom)

    If it was for a personal projet I would not mind using subdomain.

    Do you think its some kind of wordpress limitation?

    Could be… But I am not really qualified to say though. I am more into web programming, not server stuff.
    You can try deactivating all plugins and changing the themes, if you haven’t tried it yet.

    You have a configuration issue. You installed WP in its own directory… which is fine but you will run into problems like you have with subdomains. Previously WP didnt allow mapping sites to another (sub)domain if you installed in its own directory. I am not sure if that is still true.

    I think if you reverted back to your original configurations, you should be able to get subdomains to work if you added the directory, e.g. http://anotherwebsite.com/test/

    I recommend either installing WP in the root directory or install its own directory but removing the directory from the path e.g. http://domain.com/https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘multisite installed in subdirectory with domain mapping error 500’ is closed to new replies.