Expertise level: Medium
To preview the content of a website without modifying the DNS configuration of a domain is to (temporarily) force your computer to make the domain point on a specific IP address. Follow these steps to do so:
Open up your hosts file with a text editor (such as notepad). Click on "Start" -> " Run" and execute the following shortcut;
You may also go review the file manually, it is located in the location "C:\windows\system32\drivers\etc\hosts".
In the file, you will see something that looks like this:
(IP address) (domain)
You must add an entry corresponding to your server's IP address, then a space and finally, your domain. Example:
Now, your-domain-name.com will resolve to the IP address 255.255.255.255 and load accordingly.
Having an entry like that in your host file will override any DNS configuration currently in place, locally on your computer. Do take note that you must save the file in order for this modification to take effect.
That is the easiest way to see content from a specific IP if you have limited access to the remote server.
Please go through the relevant screenshots attached below:
Linux & OS X
Under OS X and most Linux distributions, the hosts file is located under /etc/hosts (for Mac OS X: /private/etc/hosts).
The file can be edited following this procedure (usually the same under OS X and Linux):
- Open a terminal
- Type: sudo nano /etc/hosts (step 2 and 3 are not necessary if you are logged in as root)
- Enter your root password
- Add a line to the file with the domain name and the desired IP
- Hit Ctrl + X to save
- Confirm that you want to save and exit