0

I have a website which is hosted with COMPANY 1 and the domain is registered with COMPANY 2.

I want to change the hosting from COMPANY 1 to COMPANY 3 and leave the domain registered with COMPANY 2.

To achieve this, I have setup hosting with COMPANY 3 and I have uploaded the website. This means that all I need to do is point the domain to the new hosting and then disable the old hosting however, firstly I need to view my website to make sure it is working. Is there a way to view the site using a shared IP?

I have tried using IPADDRESS\~username however, this just takes me to a 404 page.

2
  • 1
    You need to edit your local "HOSTS" file (which overrides the DNS on your machine). The exact process varies depending on whether you are using Windows, Mac or Linux. (I would have thought this question has been asked before but I can't find it?)
    – MrWhite
    Aug 17, 2015 at 7:54
  • Another option, many web hosts create sub-domains of the web hosts own domain that will give you access to the site while setting it up. You can simply ask what it is.
    – closetnoc
    Aug 17, 2015 at 14:15

1 Answer 1

2

What you need to do is make a temporary subdomain using an A record pointed to the new shared server. Call it something like testing.example.com and point it to the new servers IP. Then ftp in, open or create an .htaccess, and point the request to whatever folder it needs to run using something like following. We will assume for this example that it's a platform installed in a folder called "newapp":

RewriteEngine On
RewriteCond %{HTTP_HOST} ^testing\.example.com$ [NC]
RewriteRule ^(.*+)$ newapp/$1 [L,QSA]

If your app routes all via index.php, you may have to edit the .htaccess in the "newapp" folder as well to pick up the request (which is the $1 in the snippet above). In Wordpress for example, the line containing index would now look like this:

RewriteRule . index.php$1 [L]

The best part of setting it up this way is that you can leave the original running while you get the new online. Also you can bypass host subdomain or parking limits, do not need to utilize [restricted] addon domains, or use other "gui" style methods of attachment. When you go live you can just change the ^testing\.example.com$ part of the snippet into your live domain like so ^(www.)?example.com$, change the example.com TLD A record, and shut down the old site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.