When doing website development for a domain that is not yet pointed to the Linux/Apache server you are developing on, you can often point to the directory with a URL consisting of the IP address followed by a tilde, which is this squiggly thing ~ and then the FTP user name like: 205.251.100.100/~theuser
But if you are working with backend administration directories like CPANEL and wp-admin, you need to set up a DNS reference within your “hosts” file. On OSX this is either accessed using the TERMINAL application (which is a non-graphical interface that makes me feel really computer-geeky, and which is in the Applications/Utilities folder).
In OSX Lion I would simply open the terminal and type: sudo nano /private/etc/hosts, which opens the Hosts file using a program called nano. You’ll probably be looking at a file like this:
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
Add your DNS routing like this:
Then Flush the Cache using this command:
But in Mountain Lion that doesn’t work! It may be because the hosts file has a “sticky” protecting it from being edited. SO…
Here’s the process that finally worked.
1) First you need to log-in as the Root User in Terminal using the following command:
Enter your OSX password
2) Then you need to remove the “sticky” lock assigned to the hosts file that prevents people from modifying it:
3) Edit the hosts file as per usual via the following command:
“Control O” to Save
“Control X” to Exit
File will be similar to this:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
205.251.100.100 www.domainname.com domainname.com
4) IMPORTANT: LOG OUT of root:
5) Flush your cache to ensure the new hosts file is current:
6) Log back in at root user again:
7) Go ahead and reapply the “sticky” lock so the hosts file doesn’t modify itself:
8) log out as root:
9) Log Out as user:
You should see message:
I hope this saves you some time. Have a great day.
Mike