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.

WordPress

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?

Many thanks.

5 Answers

Matt Campbell
Matt Campbell
9,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:

  1. Download existing site and database.
  2. Upload new WP install and database.
  3. In options table change site url. It's the first box, to the new domain with trailing slash.
  4. Get a copy of replace.php, google search will find it.
  5. 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.
  6. 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?

Matt Campbell
Matt Campbell
9,767 Points

It keeps them all separate. They're two distinctive sites and unique. A sub domain is a site completely separate from the current site whereas a directory in the main site is just a part of the current site.

What you should really have is your own hosting that you put client sites on. The way you're doing it isn't the most professional and the client has access to the files from the get go.

If you have it on your hosting account, you don't deliver the files till the final invoice is paid. Too many people post about, client hasn't paid me and they have the files...what do I do now? Well, the only answer is either take them through a lengthy claims process or cut your losses.

Get 50% payment up front, 50% prior to final upload. Either get them to write the brief or write it based on their requirements and then appendix that to a contract.

Make clear that any changes outside of the scope of the brief will incur charges otherwise you'll be stuck with, can we just change this and that for weeks. Do a wireframe before design, get it signed off. Then do design, get it signed off. Then develop. Make clear that any changes to a stage post-sign off will incur charges.

Clients seem to think that as soon as you agree to build a site they're paying you a salary and can endlessly ask for alterations and revisions. I've got caught out recently with a client that has potential for much more work and was being lenient with alterations. I ended up redesigning and redeveloping each and every page at least 4 times. A site that was FINISHED in 4 days, is now into its 5th or 6th week. I've lost track. I dropped my usual rules because of the premise that there could be a lot more work coming so, stick to your guns, be tough and be ruthless. If clients wants something changing, they pay for it.

A good way to charge is in blocks of hours. I have 5 hour and 10 hour blocks and can say it'll be half or a full day or whatever quite easily.

Use the move tool within cpanel. See 6:23ish in this video https://www.youtube.com/watch?v=J9HytNlq6JY

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...