We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 617
    • 10 Posts
    Hi

    I am testing MODx ofn a live server and have installed it in a subdirectory e.g http://site_name.co.cc/modx/. I have used a Redirect directive in the web root’s .htaccess file to direct requests from http://sitename.co.cc to http://site_name.co.cc/modx/. However, I would like to go one further and hide the "modx" subdirectory name in the rendered address in the browser. Thus requests to http://sitename.co.cc will display exactly that and not http://site_name.co.cc/modx/.

    P.S. Just to re-iterate, I am not currently using the .htaccess file in the modx subdirectory. However If I need to in order to solve this, I will gladly do so.

    Any help will be deeply appreciated.

    Regards
      • 617
      • 10 Posts
      Right, the following code works initially, ie when http://site_name.co.cc is entered in the browser, the site is displayed as expected and the "modx" subdirectory does not appear in the URL.  However, when any link on the site is clicked, even the "Home" link in the horizontal top menu, the "modx" submenu appears in the URL. Any suggestions on ways to hide the subdirectory when browsing to all links on the site?

      Regards

      RewriteEngine on
      
      
      RewriteCond %{HTTP_HOST} ^(w{1,3}\.)?site_name\.co\.cc$
      RewriteCond $1 !^modx/
      
      RewriteCond %{REQUEST_URI} !^/modx/
      
      RewriteCond %{REQUEST_FILENAME} !-f
      #RewriteCond %{REQUEST_FILENAME} !-d
      
      RewriteRule ^(.*)$ /modx/$1 [L]