Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
How to build new Wordpress site in background on existing domain, then replace existing site when it's ready to go live
Hi, am hoping someone might be able to advise me on this.
I am developing a new Wordpress site for my first ever client.
My client has an existing Wordpress site, hosted at their domain name: clientsite.com
I would like to be able to build the new prototype site in the background on their current domain in a subdirectory e.g. clientsite.com/development
When the new site is ready to go live, I would like to be able to archive their existing Wordpress site to a subdirectory e.g. clientsite.com/archive.
I would then also like to transfer the new site from clientsite.com/development so that it displays from the main URL clientsite.com
Would anyone who has previously done something similar be able to advise me on what would be the most straightforward way to achieve this please?
Matt Campbell9,767 Points
You're better off creating a sub-domain on their hosting account. dev.clientsite.com or something.
Then you can upload, edit, modify all you like in a staging environment.
To move a site, there's a tonne of tutorials out there but the way I do it is this:
- Download existing site and database.
- Upload new WP install and database.
- In options table change site url. It's the first box, to the new domain with trailing slash.
- Get a copy of replace.php, google search will find it.
- Go to site domain /replace.php and run two search and replaces. Replace old dev domain so http://dev.clientsite.com/ with http://clientsite.com/ Remember to do it twice. Once with trailing slash and once without.
- Go to wp-admin and settings, resave permalinks.
That's it...really simple. Once files are uploaded, will take about 5 minutes to upload database, change site url and run a replace.
Awesome, thanks Matthew - that does sound pretty straightforward from the way you've explained it.
Out of interest, what is the advantage of creating a subdomain for the staging environment, over creating a subdirectory? This isn't a distinction I've succeeded in grasping yet.
Would you also recommend creating a subdomain for the archived site, once the new site goes live?
hi Adam - thanks very much for your reply. That video looks potentially useful for future reference.
What I am also trying to find out more about are the specifics of moving Wordpress installations around within an existing domain - and the modifications I will need to make to configuration settings when I move the current root files to a subdirectory. And then additionally, how to point the root URL to the new site's subdirectory etc.
If anyone knows of any step-by-step tutorials on these topics, that would also be extremely useful.
Thanks for giving such a detailed response Matthew, and sorry for not replying sooner - haven't had a chance to visit Treehouse for a while! The payment strategy is particularly valuable advice, had been wondering how to approach it. 'Be ruthless' - ok, noted! :-) Hope you finally managed to extricate yourself from your client's spiralling demands...