Today i’am sharing with you little trick, which can help you when you build wordpress in your localhost and at the and to move it to server.

We know that for this purpose there are a lot of plugins and there is also manual way to do it.

  1. Moving filesystem – required step
  2. Moving(export->import) database – required step
  3. Changing DB details wp-config.php – required step
  4. Changing  sitename and homepage rows in wp_options mysql table – required step
  5. Updating post content, post guid etc. which contains localhost strings – optional step.

But with performing little trick in our local computer we can avoid 4 of 5 steps above. What is this trick? It is called HOSTS.

Here is how to do it:

Before installing wp in your localhost (f.e. in  public_html)  open your system hosts file (for Windows it is in C:\Windows\System32\drivers\etc folder, for Linux it is in /etc/ folder, for OSX it is in /private/etc/ folder.)

put this line there:

Save it. That’s all. Now extract wordpress zip file to your public_html/  localhost folder. Then open in your browser, you will see localhost wp installation there. All options for this localhost website will be considered for That’s why when you migrate it to server, it will not need any changes. You will only need to change database name,password in wp-config.php.

Note that installing wp to any subfolder in your localhost will need another config.  Because hosts works with only IP based redirection. For example the row “” will not work there. So you need to set for this new subfolder and then to set

on your hosts file.

So, if your localhost’s public_html folder is busy and you have to install new wp to localhost subfolder. You can do it in your webserver config files(Apache, Nginx etc.). You should create new localhost website for this subfolder there – how to do it? – In the next article i will explain how to create new localhost for any subfolder of your main localhost with Apache. And they both will work perfect.

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>