问题
I have an MODX site running on the shared server in the root folder (i.e. public/www/).
I also have an MODX testing site running in the subfolder (public/www/modxtest).
I want to move this testing site into the root in a way that the modx site in root folder is not affectetd until the end of migration.
I haven't touched MODX before and do not know the migration procedure.
One way of doing that may be using htaccess file and redirect the request to the root MODX site to the subfolder MODX site as in https://my.bluehost.com/cgi/help/347
This method might get confusing for other person as they wouldn't know this redirection happening and might happen to delete the subdirectory as prefixed 'test'.
What could be the better and reliable way for complete migration from subfolder to the root folder?
Thanks in advance
回答1:
You don't specify which version of Modx you are using, but I assume it is Revo.
Moving a Revo-site can be difficult, but I've done it several times, so I've made a simple list over things that I have to do.
- Move all the files to the right directory.
- Open
config.core.php
in the modx-root. Enter your new path here - Open
core/config/config.inc.php
and change all the paths and relative urls to match your new folder/url. - Upload the
setup
-folder to your modx-root. If you don't have this folder, download it from modx.com: NOTE: Remember to upload the setup-folder for YOUR version of Modx as these may include changes. Uploading wrong setup may cause your Modx to crash. You can check your current Modx-version in your Manager-panel. Do this before moving all your files. - Run the setup (select existing site).
- All done.
To find your full path, this PHP-script should do the magic:
<?php
echo dirname(__FILE__);
?>
Place this in the Modx-root. This will be your root-path.
This should be a pretty bulletproof way to do it, but remember to take backup of all your files and be careful when changing paths and urls.
回答2:
Thanks for your answer OptimusCrime. Just followed the steps and all was well apart from the RewriteBase in the .htaccess file.
To resolve this:
3(a). Open .htaccess and change the RewriteBase, if present, from the old root to the new root.
For example: Change RewriteBase /old-modx-root/
to RewriteBase /new-modx-root/
来源:https://stackoverflow.com/questions/13556466/move-modx-site-from-subfolder-to-root-folder