Jump to content

Cre8asiteforums Internet Marketing
and Conversion Web Design


Photo

How To Build New Site On New Server While Existing Site Is Live


  • Please log in to reply
15 replies to this topic

#1 cre8pc

cre8pc

    Dream Catcher Forums Founder

  • Admin - Top Level
  • 14673 posts

Posted 28 June 2016 - 11:01 AM

In other words...the domain is pointed to the existing server.

 

Site is undergoing redesign on a new server, and will retain the same domain.

 

So far, I have the new server set up with the domain but it is not pointed to the new server yet, and won't be until the new site is completed.  

 

Should I create a /dev directory or just build at root and password protect it until launch, (domain will be pointed at that point).

 

Or?

 

This is WordPress.



#2 bobbb

bobbb

    Sonic Boom Member

  • Hall Of Fame
  • 3313 posts

Posted 28 June 2016 - 12:41 PM

Presuming the domain is www.cre8pc.tld and you say:

So far, I have the new server set up with the domain but it is not pointed to the new server yet

If you edit your hosts file and point to the new IP then you can trick your computer to resolve to it.
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
1.2.3.4 www.cre8pc.tld

Now your browser would send a request to 1.2.3.4 with www.cre8pc.tld set as the host with an http "GET /" request instead of where the live server lives.
You might have to edit C:\Windows\System32\drivers\etc\hosts as an administrator and your anti-virus might complain.
 

Now the real site is not available to that computer. You must have another?


Edited by bobbb, 28 June 2016 - 12:43 PM.


#3 wiser3

wiser3

    Mach 1 Member

  • 250 Posts Club
  • 274 posts

Posted 28 June 2016 - 02:19 PM

I start development version on my localhost. (I have XAMPP on me desktop system.)

 

When it's far enough along for others to see it i put a copy in a sub-directory of my personal site.

 

When it's done i put a copy on the live server and point the domain to it. Further development continues to take on my localhost before being placed on live site.



#4 cre8pc

cre8pc

    Dream Catcher Forums Founder

  • Admin - Top Level
  • 14673 posts

Posted 28 June 2016 - 02:19 PM

Oh cool!

 

Totally forgot about the hosts file.

 

What about showing it to the client during the build...do they need to edit their hosts file?



#5 cre8pc

cre8pc

    Dream Catcher Forums Founder

  • Admin - Top Level
  • 14673 posts

Posted 28 June 2016 - 02:21 PM

When it's far enough along for others to see it i put a copy in a sub-directory of my personal site.

 

 

I can do that too.  Had thought about it earlier but wondered about changing the urls.  These days URLs are absolute, when it used to be relative. 

 

I'm old.



#6 cre8pc

cre8pc

    Dream Catcher Forums Founder

  • Admin - Top Level
  • 14673 posts

Posted 28 June 2016 - 02:34 PM

I found this too, in my pile of stuff.  I have a lot of stuff  :dazed:

 

Quickly and Easily Move A WordPress Site From Development To Production

#7 bobbb

bobbb

    Sonic Boom Member

  • Hall Of Fame
  • 3313 posts

Posted 28 June 2016 - 02:56 PM

Oh cool!

 

Totally forgot about the hosts file.

 

What about showing it to the client during the build...do they need to edit their hosts file?

I guess so. Your situation requires the domain to be live on the old server until production. I would not want to be the one to explain this hosts file thing to a user unless I am there.



#8 bobbb

bobbb

    Sonic Boom Member

  • Hall Of Fame
  • 3313 posts

Posted 28 June 2016 - 05:49 PM

I start development version on my localhost. (I have XAMPP on me desktop system.)

 

When it's far enough along for others to see it i put a copy in a sub-directory of my personal site.

 

When it's done i put a copy on the live server and point the domain to it. Further development continues to take on my localhost before being placed on live site.

So how does this work out with the absolute URLs WP creates. In the other post we both mention SQL backups and restores. The absolute URLs are in those backups.

 

I can do that too.  Had thought about it earlier but wondered about changing the urls.  These days URLs are absolute, when it used to be relative.

I see there is a absolute to relative function in WP but seems unused.



#9 Grumpus

Grumpus

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 6587 posts

Posted 29 June 2016 - 05:24 AM

I don't think you need to get as complicated as using a hosts file.

 

Most servers have a way to access the site before the domain is set up. Many (but not all) hosts also have things built into the back end which anticipate this very situation, too.

 

One of the good things about wordpress is that most everything you do natively (e.g, adding an image, setting up the menus by clicking "add this page/post" on the menu thingie, and whatnot) actually DOES use a relative URL in a way. It basically says, "<hostname>/wp-includes/uploads/my-picture.jpg" and then automatically parses that into the full url based upon the host name you have set in your WP settings. So, when you're done, you make the domain live, change the host name in the settings and click save (which will make the world go away for a moment since you're now redirecting to the new domain so you'll need to log in again) and most of the URLs will automatically fix. The exceptions will be in page content where someone pasted the whole URL for a link instead of the relative one. Some plugins don't follow proper wordpress standards so those won't exactly work right either...

 

The final step (which you want to be prepared to do at the same moment you go live with the domain, but not before you change your WP settings) is to hit the HTACCESS file with the following:

 

In this case "olddomain.com" is the url of your staging site. newdomain.com is your new proper domain. This will "rewrite" the exising urls (in a SE friendly way) so they appear and work properly, even if they are wrong.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>

NOTE: Some hosts don't allow direct access to the htaccess and will have something in their Cpanel or hosting control center to handle things like this. This also requires that the host has mod_rewrite enabled.

 

---

 

So much of this is (somewhat) dependent upon your new host. What you are describing here is a very very common scenario (probably the most common scenario there is, nowadays) so a quick look through the hosts help files should get you specific info on how they recommend you handle this. They typically have it written out step by step and every time I'm working with a new host, I look up how THEY tell me to do the common things like this because their help and instructions are tailored to exactly how it will actually work on their servers. 90% of the time, they get it right - though sometimes I need to make some slight adjustments to make sure it's not just SE friendly, but SE lovely.

 

G.



#10 bobbb

bobbb

    Sonic Boom Member

  • Hall Of Fame
  • 3313 posts

Posted 29 June 2016 - 11:48 AM

I don't see how using a hosts file is complicated or any more than putting stuff in .htaccess

When we mentioned relative above it was understood to be relative to root as opposed to absolute. In no way did it mean relative to the current path in the URL (..\..\..\file). I'm fairly sure both of us meant this. I checked in a test WP and the URL is coded with the protocol and host "<protocol><hostname>/wp-includes/uploads/my-picture.jpg" If they had stuck to "/wp-includes/uploads/my-picture.jpg" it would solve the issue of moving the DB with just an SQL export and import and not require "change the host name in the settings and click save" to fix all those hard coded URLs in the DB. Of course there must be a good reason for this and I make no presumption of knowing why.

Then there is this. So someone thought of it. There must be a way to turn this on globally as in a flip of a switch.
https://codex.wordpr...e_link_relative

Removes the http or https protocols and the domain. Keeps the path '/' at the beginning, so it isn't a true relative link, but from the web root base.

As the question was asked I presumed a hosting space was bought to which no domain pointed to as I'm sure she does not want anything crawling it while it is in development. Otherwise the solution was simply olddomain.com along with your htaccess fix at production time.

So far, I have the new server set up with the domain but it is not pointed to the new server yet

Of course there are more than on way to solve any problem.
 


Edited by bobbb, 29 June 2016 - 11:49 AM.


#11 Grumpus

Grumpus

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 6587 posts

Posted 29 June 2016 - 05:44 PM

 

I don't see how using a hosts file is complicated or any more than putting stuff in .htaccess

 

Say that after you've tried to teach a client over the phone or email how to find and edit their host file so they can preview the site (and then gone through it again so they can undo it once the site goes live).

 

My answer is to simply build out the site properly using the temporary domain that your new host gives you. Make it work, repoint the domain, add that code to htaccess to catch any straggling links and you're done. Clients are hiring me to do it all for them, they aren't hiring me to make them mess with write protected files in their OS folders just so they can check on my work.

 

Sure - for you and me it's easy. But not your average client.

 

G.



#12 tam

tam

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 2334 posts

Posted 29 June 2016 - 05:45 PM

So the site is moving server and you're setting the new site up on the new server and when it's done you'll swap the domain to point at the new server?

 

Non complicated options:

 

Check whether the host provides a temporary web address anyway.

Point a random spare domain at it for now.

Point a subdomain of the current domain at the new server.

User the server IP.

 

As long as you don't hard code the domain in to anything you're doing in wordpress you should just have the one setting to change to update the domain.



#13 bobbb

bobbb

    Sonic Boom Member

  • Hall Of Fame
  • 3313 posts

Posted 29 June 2016 - 06:14 PM

 

Say that after you've tried to teach a client over the phone or email how to find and edit their host file so they can preview the site (and then gone through it again so they can undo it once the site goes live).

I specifically said:

I would not want to be the one to explain this hosts file thing to a user unless I am there.

At the worse I would use teamviewer and do it for them.

 

Yes temp domains work as both you and Tam suggest then the site is open to the public. You know some SE is going to find and scrape it all. In this situation I would rename index.php to something else like delvelop.php and use a dummy index.php to make sure the site is unavailable to the SE.

 

Using the IP works if you own the server not vhost.



#14 Grumpus

Grumpus

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 6587 posts

Posted 29 June 2016 - 06:42 PM

Yeah Bobbb - I caught that mention of not wanting to do it unless in person. Which is why the htaccess solution is easier.

 

You also caught this one:

 

 

User the server IP.

 

Kim, in addtion to what Bobbb said... Even on a dedicated server - that's fine for development process, but IPs can still change at some point, so you still need to deal with that. If a site suddenly went crazy, looking for an IP change would be one of the last places I looked - and then I'd curse the previous site admin up and down for going at it that way.

 

Tam's got it right on the other options though - just access the site how you can with the old domain on the old site and build it out. That's the proper way to do it.



#15 bobbb

bobbb

    Sonic Boom Member

  • Hall Of Fame
  • 3313 posts

Posted 30 June 2016 - 03:01 PM

Something I learnt when moving a bunch of sites was that there would still be some traffic on the old server even after that 24 hour period when DNS should have propagated across the world. I made sure the old site was no longer available via an IP by deleting the domain from the plan.

Any of these solutions we have discussed have some gotcha or other that require some on-the-fly thinking.

On a humourous note, even in person I would not have taught a non-tech how to change the hosts file. I would have done it myself and said something like "I'm going to perform some hocus pocus magic here and arrange this PC only to have access to the new site." I would not have slowed down so they could takes notes. I learnt that a bit of knowledge in the wrong hands can be dangerous especially if the person is not timid.  :)



#16 cre8pc

cre8pc

    Dream Catcher Forums Founder

  • Admin - Top Level
  • 14673 posts

Posted 30 June 2016 - 06:58 PM

Something I learnt when moving a bunch of sites was that there would still be some traffic on the old server even after that 24 hour period when DNS should have propagated across the world. I made sure the old site was no longer available via an IP by deleting the domain from the plan.

 

 

Good reminder!

 

Check whether the host provides a temporary web address anyway.

 

They do.  Plus password protection so that only me and the client can see it.

 

I'll start it next week, now that I feel more confident after all the advice here.

 

Thank you so much!





RSS Feed

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users