Access site using ip/~user - Hosts file example
I'm trying to preview my WP site before changing domain name servers.
Using (shared) ip/~user doesn't work properly as the site shows plenty 404s and I cannot browse it.
I've read lots of threads here on this same subject; most point out the best solution is to modify the hosts file (windows in this case), but there isn't a precise example on how to do it.
Can someone please post an example on how the hosts file should be edited?
I mean the exact line that should be written on the hosts file; e.g.: server.shared.ip/~user - mydomain.com - '?
Thank you!
-
The hosts file should include examples # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost You must edit it as administrator. 0 -
Hi, thanks, but that's what I've been reading in other posts and websites, and I still don't get it. Could you please write me the exact line I should enter on the hosts file? Let's say the server (shared) IP address is: 185.851.185.851, how do I go adding my cPanel username and the domain name of the site? # Copyright (c) 1993-2009 Microsoft Corp. # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # 185.851.185.851/ ~cPaneluser # mydomain.com "? # 0 -
You'll want to remove the # symbol in front of the line as that indicates a comment. For your example IP, you would just do this: 185.851.185.851 mydomain.com You will likely need to reboot your computer in order for this change to take place on a Windows system. 0 -
Thank you! I was under the impression I needed to include the cpanel user since there's plenty more sites on that IP address, but that worked great! I'm just getting that the SSL certificate is not valid but guess that's normal until I redirect the actual domain name. Now that I see everything works I can do that, thanks again! 0 -
Correct, SSLs won't work on the IP address so you can ignore that error/warning until the DNS is pointed. I'm glad to hear things are working well! 0 -
You will likely need to reboot your computer in order for this change to take place on a Windows system.
No need to reboot, it works immediately after the change.0 -
Oh good to know! I haven't tweaked one on Windows for some time. 0
Please sign in to leave a comment.
Comments
7 comments