{"authorId":1,"title":{"title":{}},"slug":"creating-multiple-sites-on-a-local-web-server","postDate":1196897095,"expiryDate":null,"enabled":1,"fields":{"2":"<p>So while I was redesigning my site, I needed somewhere to develop the new design. I didn&rsquo;t want to have to setup a sub-domain on the live site because that would be a pain to have to FTP files up everytime I changed something. So I installed <a href=\"http:\/\/www.apachefriends.org\/en\/xampp.html\">XAMPP<\/a> on my computer.<\/p>\n\n<p>Basically, XAMPP is a all in one Apache web server. It installs Apache, PHP, MySQL&hellip;everything I needed.<\/p>\n\n<!--more-->\n\n<p>Once you install it, you get a web directory here <strong>C:Program Filesxampphtdocs<\/strong> (or whichever directory you install XAMPP to). That&rsquo;s great, everything works fine when you put things in that directory and browse to <strong>localhost<\/strong>. But what about if you want to setup multiple sites? That is where I really had to do some digging.<\/p>\n\n<h2 class=\"replaceHeadline\">Setting Up Multiple Sites<\/h2>\n<p>I found this really good article that walks you through <a href=\"http:\/\/www.campbellssource.com\/multiple-website-on-xampp\/\">setting up multiple sites on XAMPP<\/a>. The article was a little longer than I thought it had to be, so I thought I would clarify some things.<\/p>\n\n<ol>\n<li>Find this file: <strong>C:Program Filesxamppapacheconfextrahttpd-vhosts.conf<\/strong>, and open it in notepad.<\/li>\n<li>Find a line that says something like <strong>NameVirtualHost *:80<\/strong>. Remove the <strong>#<\/strong> sign that you see in front of it; this turns it from being a comment to code that is actually executed. (This was not in any instructions I could find)<\/li>\n<li><p>Next, scroll to the bottom, and you can add multiple domains. Here is what mine looks like:<\/p>\n<div class=\"codeblock\"><code>\n&lt;VirtualHost&nbsp;*:80&gt;<br \/>ServerAdmin&nbsp;webmaster@localhost.trevordavis.dev<br \/>DocumentRoot&nbsp;\"C:\/sites\/trevordavis.dev\/webpages\"<br \/>ServerName&nbsp;localhost.trevordavis.dev<br \/>&lt;\/VirtualHost&gt;<br \/><br \/>&lt;VirtualHost&nbsp;*:80&gt;<br \/>ServerAdmin&nbsp;webmaster@localhost.trevordavis.redesign<br \/>DocumentRoot&nbsp;\"C:\/sites\/trevordavis.redesign\/webpages\"<br \/>ServerName&nbsp;localhost.trevordavis.redesign<br \/>&lt;\/VirtualHost&gt;&nbsp;\n\n<\/code><\/div><\/li>\n<li><p>Finally, find this file: <strong>C:WINDOWSsystem32driversetchosts<\/strong> and open it in notepad. You need to add an entry for each site you setup in the <strong>httpd-vhosts.conf<\/strong> file. My file looks like this:<\/p>\n<div class=\"codeblock\"><code>\n127.0.0.1&nbsp;localhost<br \/>127.0.0.1&nbsp;localhost.trevordavis.dev<br \/>127.0.0.1&nbsp;localhost.trevordavis.redesign&nbsp;\n\n<\/code><\/div><\/li>\n<\/ol>\n\n<h3 class=\"replaceHeadline\">That&rsquo;s It<\/h3>\n<p>Once you have done this you can browse to <strong>http:\/\/localhost.trevordavis.dev<\/strong> and <strong>http:\/\/localhost.trevordavis.redesign<\/strong> on your computer when you have your web server running. This means that you can view PHP files and execute SQL locally.<\/p>\n\n<p>It&rsquo;s great.<\/p>\n\n<p>Let me know if you have any questions.<\/p>","4":{"website":{}}}}