Nick La at webdesignerwall wrote a great article about how to install WordPress locally.
I’ve been using that solution for a long time with some extra steps on it mainly for migrating to a production server without any hassles after your design and development work is done.
Emil Milanov from www.milanogw.net sent me an e-mail asking about my solution, so I decided to write this article.
The solution is pretty simple, first of all we need to create your project directories.
I’ll use the www.designandchocolate.com as an example.
We need to create a directory www.designandchocolate.com in C:\xampp\htdocs and put the WordPress installation files there.
Next step we need to configure the vhosts of apache. The configuration file of my setup is located in: C:\xampp\apache\conf\extra\httpd-vhosts.conf
Open it with any text editor and uncomment the following line:
add the following lines at the end:
Options Indexes FollowSymLinks
Allow from all
After editing the file, restart apache with the XAMPP control panel.
The last step we have to edit the hosts file. The hosts file is located at:
C:\Windows\System32\drivers\etc (You need administrative access to edit this file)
At the end of the file add the following line:
After all the steps above we should be able to test our Wordpress installation by typing www.designandchocolate.com in any browser.
Remember that we need to comment the line we added at the hosts file to be able to see the original website again. For commenting a line in hosts file, we just need to add # at the beginning, e.g.:
You might want to know how it works, basically when you type any domain name in your address bar, the system will query the DNS server the IP Address where the domain is pointed.
Your system hosts file have more priority than the DNS server, so what your system will do is query the hosts file first and if can’t find anything then query the DNS server.