We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14126
    • 15 Posts
    I use GoDaddy for hosting. They installed Modx into a folder named /modx/ under the root of my web. So to access my ModX home page I currently have to reference www.example.com/modx/.

    Is there a way to leave ModX in the www.example.com/modx/ folder but be able to reference it as www.example.com/?

    The only options I can think of are:

    1) using Mod_Rewrite to redirect requests for www.example.com/modx/* to www.example.com/* and then rewrite URLs w/out /modx/ back to www.example.com/modx/*

    2) uninstall and reinstall in the root or

    3) move the modx folder and all subfolders up a level

    Is there a better way? If not then which of the above solutions would you suggest?


    Thanks in advance... Sorry for being a ModX newb...

      • 20413
      • 2,877 Posts
      See this http://help.godaddy.com/article/424

      It’s interesting they did this! Because I couldnt get modx to run "flawless" on root
      on a godaddy account even though I had succesfully made it running on another
      godaddy in a subfolder. Now this is a release that I wasn’t the big error.  laugh
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 14126
        • 15 Posts
        Hmm I knew domain forwarding can be used to mask a domain name (like URL rewriting)... But can it also be used to mask a folder on the same domain?

        I know I can achieve hiding the /modx/ folder using a 301 Redirect and subsequent Rewrite within Mod Rewrite.

        Was hoping I could just move everything under /modx up one level to / and be done... But I don’t know if ModX has config files or something like them that might have URLs or file system paths that include the /modx/ folder in them... in which case moving the files up a level would likely break my install.

        I guess I will try to call GoDaddy and find out wth they installed it in a subfolder and see if they can fix it.
          • 20413
          • 2,877 Posts
          I argue you should NOT try to move the site... godaddy root folder + modx = problems.
          Make a nice flash intro and rename /modx/ to 1 ...just kidding tongue


          http://www.google.com/search?hl=en&q=godaddy+site%3Amodxcms.com%2Fforums
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 14126
            • 15 Posts
            Anyone else have any suggestions?
              • 24376
              • 4 Posts
              i know this thread hasn’t been active for a while, but i’m really interested in how to do this as well.

              i am currently running modx in a subdirectory ( site.com/modx ) while i’m developing the site. after i finish building the site it would be a lot easier just to publish the site somehow within modx and have everything pointing to the root. i don’t even know if this is possible. i am wanting to keep the root directory clean if possible.

              if anyone has any ideas, please post them.

              Is there a way to leave ModX in the www.example.com/modx/ folder but be able to reference it as www.example.com/?

              exactly...this is what i’m wanting to do also.

                • 25306
                • 1 Posts
                What about trying a PHP redirect script - this is what I am using on a server that I am on...

                <?php
                header( ’Location: http://www.yoursite.com/new_directory’ ) ;
                ?>

                I had installed MODx on a subfolder so I could experiment and learn and when I was happy with my results, I just replaced the index.php that was in root with the above redirect script.

                J
                  • 28121
                  • 107 Posts
                  I’d also like to know how to do this as. Surely someone has actually done this before or support can answer here?
                    • 14126
                    • 15 Posts
                    At the time when I made this post, I needed a quick CMS solution and really didn’t have months to work out the kinks w/ GoDaddy’s ModX install. If I were attempting this again I would either:

                    1) Not use GoDaddy’s automated install, and instead install ModX myself in the root folder of my web... or
                    2) Use Mod_Rewrite to solve the problem assuming all pages on the site use ModX.

                    The first option should be self explanatory. The second option would involve setting up basically 2 Mod_Rewrite Rules in the .htacces folder in the root of your web. At the time I made the original post, I didn’t have 2 months to learn all the intricate details of Mod_Rewrite or to debug the problem, so I went w/ WordPress instead. I could stumble through the Mod_Rewrite solution now.

                    Essentially, if a browser/crawler (user agent) requests a URL on my site (example.com) and the URL requested was of the form example.com/modx/blah... then I would 301 redirect the request to example.com/blah using a Mod_Rewrite RewriteRule/RewriteCond. Then when the user agent requested the example.com/blah URL I would simply URL rewrite it (without a redirect) BACK TO example.com/modx/blah. This would leave the nice clean URL example.com/blah in the browser address bar while behind the scenes the server would secretly serve up example.com/modx/blah and return a 200 status. Crawlers would think the content received was generated by example.com/blah even though it really came from example.com/modx/blah.

                    I haven’t tested the rules, but off the top of my head I believe the Mod_Rewrite rules that would need to be placed in the .htaccess file in the root folder of your web would likely look something like:

                    RewriteEngine on
                    RewriteBase /

                    # Check first to see if it included modx and if so 301 redirect w/out modx
                    RewriteCond $1 modx/(.*) [NC]
                    RewriteRule (.*) http://www.example.com/%1 [R=301,L]

                    # if get this far then page in URL does NOT start w/ modx so URL rewrite
                    RewriteRule (.*) http://www.example.com/modx/$1 [L]

                    The above assumes that you prefer to use the www version of your URL as their canonical form. If you prefer the non-www version of your URLs then you would simply modify it to remove the www.

                    RewriteEngine on
                    RewriteBase /

                    # Check first to see if it included modx and if so 301 redirect w/out modx
                    RewriteCond $1 modx/(.*) [NC]
                    RewriteRule (.*) http://example.com/%1 [R=301,L]

                    # if get this far then page in URL does NOT start w/ modx so URL rewrite
                    RewriteRule (.*) http://example.com/modx/$1 [L]
                      • 28121
                      • 107 Posts
                      I haven’t tested the rules, but off the top of my head I believe the Mod_Rewrite rules that would need to be placed in the .htaccess file in the root folder of your web would likely look something like:

                      Hi jhodson

                      I am interested in the rewrite .htaccess example you wrote but it doesn’t work. I am trying to achieve exactly the same
                      scenrio here. Any chance you could revisit this and correct? smiley
                      Many thanks