Testing your files on the new server

Discussion about BCA's Internet Hosting Service
User avatar
David Gibson
DG test
Posts: 622
Joined: Thu 16 Mar 2006 23:45

Testing your files on the new server

Post by David Gibson » Fri 17 Jun 2016 09:54

for those migrating from britiac2 to britiac3...

Before you switch the DNS to point to the new server your new web pages are accessible as britiac3.miniserver.com/~username in "the usual way". However, for this to give you a proper view of your web site you must be using relative links, not absolute links. For example, you need to access your CSS file as (for example)

Code: Select all

<LINK REL="STYLESHEET" HREF="index.css">
and not

Code: Select all

<LINK REL="STYLESHEET" HREF="/index.css">
The reason for this is that any relative link will be interpreted as britiac3.miniserver.com/~username/somepage whereas an absolute link would be interpreted as britiac3.miniserver.com/somepage, which does not, of course, work.

It may be that your web site needs absolute links because of the way you have constructed it. That is certainly the case for me. In this situation you cannot test your site using ~username. Instead, the approach I have adopted, for my sites, is this...
  • In the DNS for your domain, create a sub-domain (e.g. newsite.mydomain.co.uk) that forwards to the IP address of the new server.
  • In the control panel for the new server, at http://britiac3.miniserver.com/cpanel, create a corresponding sub-domain for your site and specify the root location to be the same root as for your main site (so probably something like /home/username/public_html
Now you should be able to access your new site as newsite.mydomain.co.uk and all the links should work. To give public access to your new site, you just need to alter the DNS for mydomain.co.uk to also point to the new server.
Last edited by David Gibson on Thu 27 Apr 2017 17:29, edited 1 time in total.
Reason: de-stickified this older post
this is my signature

David Cooke
Site Admin
Posts: 303
Joined: Thu 29 Dec 2005 23:22
Location: Axbridge, Somerset, UK

Re: Testing your files on the new server

Post by David Cooke » Fri 17 Jun 2016 10:42

For those that don't have easy access to the DNS I have heard tell of a solution that involves /etc/hosts.

I've not tried it before now because I've always had easy access to the DNS.

It is simply to add a record for the test domain to /etc/hosts or /windows/system32/drivers/etc/hosts (on windows) on your local PC. The /etc/hosts file is checked before the DNS and therefore overrides it. So for the above example add a line:

Code: Select all

31.25.186.126       caving-library.org.uk
I just tried it and it works :D

Firefox needed a restart to recognise the change.
Dave Cooke
BCA IT Working Party, BCA Web Services, National Cave Registry Co-ordinator, CSCC Webmaster

User avatar
David Gibson
DG test
Posts: 622
Joined: Thu 16 Mar 2006 23:45

Re: Testing your files on the new server

Post by David Gibson » Fri 17 Jun 2016 11:25

Ah yes, Id completely forgotten about that. If you use this method, do not a) forget that you have made the setting, or b) forget that you didnt also make it on the laptop youre currently using - Past experiences !!!
this is my signature

Post Reply