Xampp Host Website

Posted on  by admin

Place Web Site Content Within the DocumentRoot. Perhaps the easiest option – and the one requiring least change – is to place your web site content within the default DocumentRoot folder /Applications/XAMPP/xamppfiles/htdocs/ remembering to replace, rename or delete the existing index.php there. A request to localhost then serves the following page. A PHP code will run as a web server module or as a command-line interface. To run PHP for the web, you need to install a Web Server like Apache and you also need a database server like MySQL. There are various web servers for running PHP programs like WAMP & XAMPP. WAMP server is supported in windows and XAMP is supported in both Windows and Linux. XAMPP is a cross-platform and open-source web server package. It is completely free to download and use and is developed and updated by Apache Friends. The main components include the Apache HTTP Server and the MariaDB database. Also included are the interpreters that can read Perl and PHP scripts. Step 1, Go to in a web browser. This is the web page do download the XAMPP client.Step 2, Click the link for your operating system. XAMPP is available for Windows, Linux, and macOS. Click the download button for whichever system your computer runs on. You will be redirected to a download page and your download will start automatically. If your download does not start automatically, click the green text that says click here at the top of the page.Step.

  1. Xampp Tutorial
  2. Using Xampp
  3. Xampp Virtual Host Website
  4. Download Xampp For Windows
  5. Xampp Hosting Multiple Websites

Localhost is a local web server for testing and development. In this tutorial, we learn to install XAMPP and setup localhost.

What Will We Learn

  • Install XAMPP
  • Setup a local web server or localhost
  • Learn to view HTML file in localhost

What is XAMPP?

XAMPP is a free and open source cross-platform web server. It is simple and easy to setup. XAMPP stands for Cross-Platform (X), Apache (A), MariaDB (M), PHP (P), Pearl (P). After installing XAMPP, you have a local web server with database.

Download XAMPP

Go to Apache Friends, and download XAMPP.

Choose a PHP version based on your need. If you do not have specific requirement for PHP version, just choose the latest one which is 7.2.1 / PHP 7.2.1.

Install XAMPP

After downloading XAMPP, double click to launch the installer.

Click on Next and proceed with the installation.

In this section, you can choose what components you need. To setup localhost, we only need to install Apache and PHP. However, I would recommend installing Apache, PHP, MySQL and phpMyAdmin for standard web development environment. MySQL (MariaDB) and phpMyAdmin are used to setup database. By installing database, we can setup popular CMS like WordPress.

*Although MySQL is listed in this setup screen, the installed database is MariaDB.

Select a folder to install XAMPP, then continue with the installation.

Uncheck it then continue with the installation. The installation starts after this step. Wait for a few minutes for the installation to be completed.

At this step, we have completed the installation. Click on Finish to close the installation window.

After completing the installation, you may see this security alert from Windows Firewall. Click on Allow Access to allow XAMPP to run on your computer.

Launch XAMPP

After the installation, it is time to launch XAMPP.

When you launch XAMPP for the first time, you have the option to choose your language.

Setup Localhost

Click on Start for Apache module. Now localhost is ready to be used. You can access your localhost by opening your browser and enter http://localhost/ into your browser.

If you able to see this page, it means you have successfully setup localhost environment in your computer.

To load your file from localhost, you need to place your file into htdocs folder inside XAMPP. If you install XAMPP in the default directory, the path should be C:xampphtdocs

For learning purpose, you can download an index.html file from here. Place the file in your htdocs folder, then open it with this URL, http://localhost/index.html

If you see the image above, you have successfully viewed the html file in localhost. That’s all for this tutorial, hope you enjoyed it.

Tutorial Files

¤ Home » Programming » PHP » How to setup multiple websites in XAMPP

By default XAMPP is setup to run at http://localhost and serve pages that are kept under C:/xampp/htdocs. In this situation, if you want to develop multiple websites, you will need to create a folder under C:/xampp/htdocs for each website and keep the website files thereunder. For example, for a website xyz.com, you may create a folder such as C:/xampp/htdocs/xyz as the root folder for xyz.com and then during development, access it with URL http://localhost/xyz/. Likewise, for another website abc.com, you will create C:/xampp/htdocs/abc as the root folder and access it with URL http://localhost/abc/.

This is not a very nice way of working with multiple websites on your XAMPP. You would rather prefer to replicate the exact situation as if xyz.com was hosted on an internet server and access it with URL http://www.xyz.com.

How to achieve this?

With a little extra effort, you can configure your XAMPP in such a way so that you can access xyz.com with URL http://www.xyz.com and abc.com with URL http://www.abc.com. To achieve this, you need to setup multiple virtual hosts under XAMPP.

Xampp web host not working

To explain the concept and the method, we will take the example of website xyz.com. The steps to achieve this are as follows:

Xampp Tutorial

Step 1. Create a folder for xyz.com

Create a folder C:/xampp/htdocs/xyz.com/public_html. Now, we will setup public_html as the root folder for the website of xyz.com so that when you access http://www.xyz.com, the Apache web server will serve page from this public_html folder.

Using Xampp

Step 2. Create a virtual host under Apache web server

Navigate to the folder C:/xampp/apache/conf/extra. Open the file httpd-vhosts.conf in a text editor. At the bottom of this file insert the below lines of code/directives.

Xampp Virtual Host Website

Now restart Apache, i.e. Stop and Start.

Note that you can have multiple entries of the above lines of code, one for each website that you add under your XAMPP.

Step 3. Local DNS Setup

Next, you need to tell your Windows OS, to which IP address it should resolve the domain name www.xyz.com or xyz.com. Since xyz.com is hosted locally, it should resolve to the localhost IP, viz. To achieve this, navigate to C:/Windows/System32/drivers/etc/ folder and open the hosts file in a text editor. At the bottom of the hosts file, add the below line of code.

Download Xampp For Windows

Now you are all set to start building your website for xyz.com locally while remaining offline.

Xampp Hosting Multiple Websites

After you have completely built your website and tested it thoroughly and then deployed it on an internet server, just comment the above line of code (as shown below).


Once commented, xyz.com will no more resolve to the local IP Instead, it will resolve to the actual IP of the internet server where xyz.com has been eventually deployed. Every time you need to do local development on xyz.com, you can switch back to local mode by un-commenting the code.

Please enable JavaScript to view the comments powered by Disqus.comments powered by Disqus