Specifically, how do you handle a client who has an existing website that you are replacing?
I just did this last night for an Evo to Revo conversion.
This worked really well and I didn't even have to create a virtual host, although in my case, the client's original site was in a subdirectory I'll call clientSite, reachable at clientSite.com:
Installing
- Create a subdirectory called clientSite2 - it should be accessible with yourdomain.com/clientSite2.
- Copy the MODX files to the clientSite2 directory, or use one of the installer scripts mentioned on the forums there.
- Put this in the browser's address bar: http://yourdomain.com/clientSite2/setup. (you may need to create the database first)
- If Setup goes well, let it delete the Setup directory
- Once MODX is installed, you should be able to log in by going to http://yourdomain.com/clientSite2/manager/
Building the site
This part is all done the normal way. All your templates need this tag in the head section:
<base href="[[++site_url]]" />
If, for some reason, that doesn't work (internal links fail), use this one:
<base href="http://yourdomain.com/clientSite2/" />
All internal links on the site should be in the form of link tags:
<a href="[[~12]]">Some Text</a>
The number in the link tag is the Resource ID of the resource it points to (visible in parentheses next to the page title in the Resource Tree at the left side of the Manager).
Putting it in place
When the site is ready to replace the original, this is all you need to do:
- (optional) If you customized the base href tag, change the href to "[[++site_url]]" or "clientSite.com".
- Log out of the dev. site
- In cPanel's file manager, edit the following four files. Change all instances of yourdomain.com/clientSite2/. to just clientSite.com (the address of the original site) -- be sure you get them all in config.inc.php:
- config.core.php (MODX root)
- manager/config.core.php
- connectors/config.core.php
- core/config/config.inc.php
- Rename the clientSite directory to clientSite.old (site goes down at this point)
- Rename the clientSite2 directory to clientSite (site comes back up as the new site)
- Important: delete all files in the clientSite/core/cache directory
- If you customized the base href tag in the template(s) and haven't fixed it yet, you'll need to change it now or internal links will not work.
At this point, the newly developed site should be working fine at original address. If not, check the paths in the four config files you modified.
You can delete the old site (in the clientSite.old directory) now, but I like to leave it there a while to make sure everything is OK with the new site. I modify the index.php files in the root and Manager folders by adding this at the top just below the starting php tag:
Don't forget to remove that line if you end up having to restore the old site.
[ed. note: BobRay last edited this post 12 years ago.]