We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47400
    • 21 Posts
    Hi all,

    I've spent a long time searching for an answer to this so I apologise if there's already a thread on this but I haven't found anything yet.

    I'm developing a website on a live server but using a domain reference as my client has their old site running on a different server and it's still live; once the site is signed off, I'll point their domain to my server.

    I can't seem to get friendly URL's working at the moment. I've tried a couple of methods, including the one in the official documentation, but as soon as that takes effect, I get redirected to their live site (obviously).

    This means I can't configure friendly URL's and check if they're working until after I put the site live…

    Is there a way that I can configure friendly URL's to work on the domain reference and in such a way that it will continue to work when I point their domain at my server to put the site live?

    Thanks for any help.
    Al

    This question has been answered by bvirtual. See the first response.

    • discuss.answer
      • 46315
      • 30 Posts
      This is what my hosting company suggests and it works well. I've tried it on windows only.

      Sometimes a temporary URL won't be suitable to test a website, for example if the website has rewrite rules that require the URL to be in a certain format, or if links are all absolute URLs.

      What you can do to test a website that won't work on a temporary URL is to update your computer's hosts file so that your computer will resolve to the domain name to the server you are testing on without the DNS being affected. The hosts file will exist at these locations:

      Windows: C:\Windows\System32\drivers\etc\hosts
      Mac: /private/etc/hosts

      Open the file in a text editor and then add these lines to the end of the file:

      IP-address yourdomain.com
      IP-address www.yourdomain.com

      Where IP-address is the IP address of the server you are testing the website on, and yourdomain.com is the domain name you're testing. For a standard hosting package you can get the IP address from the temporary URL given in the control panel. For a VPS or dedicated server it would be the IP address assigned to the account.

      Once the changes have been made to the hosts file, save it and restart your browser. Then going to yourdomain.com will resolve to the server and you can test it on the main URL so you can see how the site will be when made live. You can switch back just by deleting the lines from the hosts file.
        • 47400
        • 21 Posts
        Sorry for the radio silence – busy couple of days!

        That sounds like it could work, I'll give it a try and let you know.

        Just out of interest, how do you usually develop your testing sites in terms of servers?

        Thanks for you help!