Some time for creating custom project URL there we need to give a name for the project and we want that project according to their name like ABC is my project and I want it to run on abc.com so when the project will be hosted on live server it will not make any difference for abc.com domain. Virtual host on XAMPP is a very easy process, Just follow the below instructions to create a virtual host on XAMPP
First I am going to assume you’re using a Windows machine and have XAMPP installed. Open the XAMPP control panel application and stop Apache. … Navigate to C:/xampp/apache/conf/extra or wherever your XAMPP files are located. Open the file named httpd-vhosts.conf with a text editor.
then input the configuration bellow: make sure to change your file location to DocumentRoot, Directory, and change ServerName.
<VirtualHost *:80> DocumentRoot "/Volumes/Storage/niamrox.dev/web/practice/batch_1_project" ServerName habizabi.com <Directory "/Volumes/Storage/niamrox.dev/web/practice/batch_1_project"> AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost>
After that restart your Apache Server by Xampp service.
Find your own pc IP address.
Then find and open the host file. If you are a windows user edit
If you are OSX / Mc user then open the terminal and copy-paste the following code below ‘sudo nano /private/etc/hosts’
at host, file write your ip address and server name like bellow
After that restart your apache server and browse the server name on the browser. You will find the project there.
In this way, you can test the project before deployment or when the project will be deployed on a live server it will be the same as the domain. For Linux or Mac, almost all are similar just make sure about changing the host file.
If you want to change host file at ubuntu then follow the command bellow
sudo nano /etc/hosts
here nano is an editor, you can use any other editor by its terminal command like if you want to edit on edit text editor then apply the following command
sudo -E gedit /etc/hosts
Then edit as per your requirement.
If you are using mac then there is a visual tool you can edit host files easily. Download and install Gas Mask host file editor from here.
Following the process, you will be able to create a virtual host on XAMPP. You can see our other articles to learn How to add a search bar to WordPress Menu
How to create a custom sidebar for each post and page in WordPress
How to Edit the Footer in WordPress
If you like this article, please like our Facebook Page to stay connected.
Leave a reply →
could point to two separate applications on the same server. Or, you could create separate domains, such as Virtual hosts created in this manner will not be accessible from other systems, unless those systems are separately configured to associate the custom domain used by the virtual host with the IP address of the XAMPP server. This guide walks you through the process of setting up a new virtual host with XAMPP, by creating and configuring an example host named
Comments are closed.