We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20549
    • 29 Posts
    I am converting a site that was previously publishing three top level domains with contexts to subdomains using all the same docs.

    When I access admin.mysite.com/my-file.html or mysite.com/admin/my-file.html, I see it with no problems.

    When I try to access admin.mysite.com/ or mysite.com/admin/index.php, I get a 404 error.

    I followed these directions to the letter and double checked it 10 times:
    http://www.belafontecode.com/how-to-host-multiple-sub-domains-on-modx-revolution/

    I’ve tried it with and without friendly URLs in my sub-domain htaccess files with no change in the result.
    This is what I have in my subdirectory:

    RewriteEngine On
    RewriteBase /

    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php?q=$1 [L,QSA]

    My context settings changed from
    2ndsite.com to admin.mysite.com
    and
    http://www.2ndsite.com/ to http://admin.mysite.com/
    all other context settings are unchanged.

    I’m baffled as to why modx is returning a page not found error?
    I’ve checked and double checked my config and index.php changes in the subdirectory...they are correct

    Anyone have any thoughts?

    These are my htaccess settings in my root:

    #Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /


    # The Friendly URLs part
    RewriteCond %{HTTP_HOST} ^www\.mysite\.com
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


    #REDIRECT SUBDOMAIN TO SUBDIRECTORY OF SAME NAME
    RewriteCond %{ENV:REDIRECT_SUBDOMAIN} =""
    RewriteCond %{HTTP_HOST} ([a-z0-9][-a-z0-9]+)\.mysite\.com\.?(:80)?$ [NC]
    RewriteCond %{DOCUMENT_ROOT}/%1 -d
    RewriteRule ^(.*) %1/$1 [E=SUBDOMAIN:%1,L]
    RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]