How To edit a WordPress site on a new host before spinning it live, Windows, Mac, Linux – DNS redirection

So, you are building the client a new website, using wordpress. But how do you spin it up so you can edit it quickly and efficiently?

My recommendation is DNS redirection.

This will allow you to login to  yourdomain.com and check the site out, from your 1 computer has access as if it were a live site.

cpanel works, wordpress login will work, EMAIL will NOT work inbound but may work outbound.

Anything after a # and before the end of line character is not processed (is a comment)

Most if not all computers contain a hosts file, this file allows you to map a FQDN (Fully Qualified Domain Name) to an IP address.

 

How to edit  your hosts file inWindows 7, Windows 8:

Start, programs,accessories, right click notepad, Run as administrator. (notepad opens)

file, open, browse to C:\windows\system32\drivers\etc\, filename type in the word hosts, ok,(host file will be open now).

(Commented lines begin with a # so you can turn on and off the redirection with a # before the line to go back to the internet version of your website)

most sites will have this entry in it:

127.0.0.1 – localhost

Paste in below this line your host file definition in the same format (1.1.1.1 yourdomain.com)

File, Save,

Flushing the DNS Cache:

windows key +R (opens the run dialog), type the word command, press run (Command window opens)

type the following into the command window:

ipconfig /flushdns

(will echo back dns cache cleared)

you can now test the site definition:

ping yourdomain.com

 your new ip address should now show, you can press ctrl-c to stop pinging the site.

How to edit your hosts file in  Windows Vista, XP, 98,95,3.1,3.0, NT4.0, NT3.x, 2000 or millennium.:

Start, Run. (Run Dialog box appears (Windows key +R is faster),command, press RUN (Command window will open)

edit C:\windows\system32\drivers\etc\hosts

(editing window in blue will appear)

scroll below local host with the arrow keys.

add the line

1.1.1.1 yourdomain.com # (Where your ip address goes in the 1.1.1.1 and the yourdomain.com is your domain.)

alt+f, s

(file saved)

alt+f, c (Closed back to the black window)

Flushing the DNS Cache:

ipconfig /flushdns

(will echo back dns cache cleared)

you can now test the site definition:

ping yourdomain.com

 your new ip address should now show, you can press ctrl-c to stop pinging the site.

How to edit your hosts file in OSX (Apple’s Max OS (works in almost all versions)

Browse with your mouse to: Applications -> Utilities -> Terminal.
(a black windows will appear)

edit the hosts file with this command:

sudo nano /private/etc/hosts

Type your user’s password when prompted.

(Commented lines begin with a # so you can turn on and off the redirection with a # before the line to go back to the internet version of your website)

most sites will have this entry in it:

127.0.0.1 – localhost

Paste in below this line your host file definition in the same format (1.1.1.1 yourdomain.com)

When done editing the hosts file, press control-o to save the file.
Press enter on the filename prompt, and control-x to exit the editor.

(you will now be back in the black window)

Flushing the DNS Cache: (important to see that the site has changed.)

dscacheutil -flushcache

you can now test the site definition:

ping yourdomain.com

 your new ip address should now show, you can press ctrl-c to stop pinging the site.

How to edit your hosts file in Linux (Unix, Linux, Ubuntu, Somewhat generic)
Open a Terminal window, (in ubuntu, it’s usually under system, or tools)
(a black windows will appear)

edit the hosts file with this command (if nano is not installed you can gedit or vi instead):

sudo nano /private/etc/hosts

Type your user’s password when prompted.

(Commented lines begin with a # so you can turn on and off the redirection with a # before the line to go back to the internet version of your website)

most sites will have this entry in it:

127.0.0.1 – localhost

Paste in below this line your host file definition in the same format (1.1.1.1 yourdomain.com)

Save the file in nano

When done editing the hosts file, press control-o to save the file.
Press enter on the filename prompt, and control-x to exit the editor.

(you will now be back in the black window)
Flushing the DNS Cache: (not needed on most unix systems)

ping yourdomain.com

 your new ip address should now show, you can press ctrl-c to stop pinging the site.

 

 

You are now ready to use your site as if it were live on the internet.

to reverse this process, please simply follow the instructions and put a # in front of the line you added.

and flush your DNS (if required)

 

Comments are closed.

Thumbtack Best Pro of 2015
Follow coredatarecover on Twitter Follow CORE Data Recovery on Facebook Follow Chuck House on Linked In