Results 1 to 1 of 1
-
1st Mar 2014, 10:34 AM #1
Using the 'hosts' file to test or develop a website
Overview
If you're developing a replacement website either for yourself or a client, you may find it difficult to access the development version. There are a few basic ways to do this, but with a lot of today's PHP software they don't work too well because of all the rewrite rules that are installed within websites that often re-write URLs to make them more search engine friendly.
The best way to do this is to modify the 'hosts' file on the workstation that you're using. When a computer resolves a domain name (e.g yoursiteatkualo.com) to an IP address (e.g. 1.2.3.4), it first looks at its local hosts file for any static mappings before it goes to the internet to look it up. This means that by defining a static mapping in your local hosts file, you can 'trick' your computer and therefore your website browser(s) into accessing the domain name on the new IP address, without affecting the current live website on the domain for any regular users. It only affects your local workstation.
Procedure
The location of the 'hosts' file varies depending on your Operating System, however here is a list of the most common ones.
- Windows : %SystemRoot%\system32\drivers\etc\hosts (usually, the system root is C:\Windows, so your hosts file will likely be C:\Windows\system32\drivers\etc\hosts)
- Linux & MacOS : /etc/hosts
In order to point the domain, you'll need to know the IP address on our systems that it is being hosted on. This can likely be found in your welcome email, however if you're unsure please feel free to ask us via our helpdesk. Once you know the IP address, the entry that you'll need to add will look like this (using the sample details above):
1.2.3.4 yourdomainatsht.com www.yourdomainatsht.com
This adds an entry that will point yourdomainatkualo.com (with and without the www. prefix) to 1.2.3.4.
You may need to clear your cache so that the changes take effect (see here and then here).
Finally, when you've completed testing or developing, remember to remove the entry or comment it out so that you may see the actual website once again.
Operating System Specific Notes
Windows 7 - you may need to run Notepad with administrative privileges in order to edit the file. To do so, find 'Notepad' in your start menu in Windows, and then right click to 'Run as Administrator' option. You can then navigate to the file via the 'File -> Open' option to edit it.
MacOS X - you will need your systems' administrative password to make changes to this file. Open the 'Terminal' application, and then type 'sudo pico -w /etc/hosts'. When prompted, supply your administrative password and then make the changes as above to the file. To exit, type 'Ctrl' then 'X' together and then you'll be prompted to save your changes.
Further Reading
You can read more about the hosts file by clicking here to view its related article on Wikipedia.Areon Reviewed by Areon on . Using the 'hosts' file to test or develop a website Overview If you're developing a replacement website either for yourself or a client, you may find it difficult to access the development version. There are a few basic ways to do this, but with a lot of today's PHP software they don't work too well because of all the rewrite rules that are installed within websites that often re-write URLs to make them more search engine friendly. The best way to do this is to modify the 'hosts' file on the workstation that you're using. When a Rating: 5
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Develop the mobile version of your website
By Ifirst in forum Useful SitesReplies: 0Last Post: 15th Oct 2012, 07:11 PM -
How to overall develop my website
By bashishtha in forum Webmaster DiscussionReplies: 2Last Post: 8th Oct 2012, 12:03 AM -
Searching for a file host that allows hotlinking to RU to other file hosts
By hndude in forum File Host DiscussionReplies: 4Last Post: 3rd Oct 2012, 07:48 PM -
disallow .bin test files for testing speed of hosts
By Siruthuli in forum Feedback and SuggestionsReplies: 0Last Post: 2nd Jan 2012, 08:33 PM -
What is the best website, which provide multi-upload support to various file hosts?
By Biqu3 in forum File Host DiscussionReplies: 18Last Post: 4th Dec 2011, 03:04 AM
themaCreator - create posts from...
Version 3.22 released. Open older version (or...