We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45028
    • 2 Posts
    Euro Coding Simulator 2012 Reply #1, 13 years ago
    In a nutshell, I want my entire MODX installation to be accessible only from https://REMOVED.net (the root of the domain) instead of https://REMOVED.net/cms/.
    This is what my web root looks like:
    drwxr-xr-x cgi-bin/
    drwxr-xr-x cms/               <- MODX
    + drwxr-xr-x cms/modx         <- Core
    + drwxr-xr-x cms/modxadmin    <- Manager
    drwxr-xr-x forums/            <- XenForo
    drwxr-xr-x wiki/              <- MediaWiki
    -rw-r--r-- .htaccess
    -rw-r--r-- robots.txt


    After trying incessantly for around five hours, I gave up, did a clean install of 2.2.9-pl advanced, and reset my .htaccess files to a cleaner slate. Does anyone here have any idea as to how I can get this to work? The furthest I got was having the MODX front end accessible both with and without "/cms/" in the URL, and the back end accessible only with "/cms/" in theURL.

    .htaccess in public_html (webroot):
    Options -Indexes -MultiViews +FollowSymLinks
    
    RewriteEngine On
    
    # Remove www prefix
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} ^www.REMOVED.net$ [NC]
    RewriteRule ^(.*)$ https://REMOVED.net/$1 [R,L]
    
    # Force SSL
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://REMOVED.net/$1 [R,L]
    
    # Friendly URLs
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
    
    # Output compression
    php_flag zlib.output_compression On
    php_value zlib.output_compression_level 5
    
    # Other stuff
    ExpiresActive On
    ExpiresByType image/gif A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/png A2592000
    BrowserMatch "MSIE" brokenvary=1
    BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
    BrowserMatch "Opera" !brokenvary
    SetEnvIf brokenvary 1 force-no-vary


    .htaccess in public_html/cms:
    Options -Indexes -MultiViews +FollowSymLinks
    
    RewriteEngine On
    
    # Set web root
    RewriteBase /cms
    
    # Friendly URLs
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    
    # Output compression
    php_flag zlib.output_compression On
    php_value zlib.output_compression_level 5


    Other info:

    • MODX Version: 2.2.9-pl (advanced)
    • PHP Version: 5.4.19
    • Database (MySQL, SQL Server, etc) Version: 5.5.32-cll - MySQL Community Server (GPL)
    • Additional Server Info: Apache 2.4.6
    • Installed MODX Add-ons: CodeMirror
    [ed. note: euro_coding_simulator_2012 last edited this post 13 years ago.]
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Mark Hamstra Reply #2, 13 years ago
      I don't think you'll want "RewriteBase /cms" in the .htaccess in the webroot, instead I'd suggest changing:

      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]

      to
      RewriteRule ^(.*)$ cms/index.php?q=$1 [L,QSA,NC]
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 45028
        • 2 Posts
        Euro Coding Simulator 2012 Reply #3, 13 years ago
        Quote from: markh at Sep 07, 2013, 01:04 PM
        I don't think you'll want "RewriteBase /cms" in the .htaccess in the webroot, instead I'd suggest changing:

        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]

        to
        RewriteRule ^(.*)$ cms/index.php?q=$1 [L,QSA,NC]
        I appreciate the tip, but nothing changed when I did that. Do you have any other pointers?

        (Regardless, I've left that change intact for now.)

        Edit: The session issue is resolved, but I am still unable to get FURLs to work properly. I can access the front end both with and without "/cms/" in the URL. The same is true for the manager's login screen, accessible at REMOVED.net/manager/; however, once I log in and get to the dashboard, the URL is changed to REMOVED.net/cms/manager. Looking around at various links within the manager, it seems MODX is still generating all URLs with "/cms/" in them (e.g. Site -> View).

        I don't want "/cms/" to be present in any URL within MODX. [ed. note: euro_coding_simulator_2012 last edited this post 13 years ago.]