How to change Localhost to domain name in Xampp

Do you want to learn how to change Localhost to domain name in Xampp? Here’s a step-by-step guide that you can use to learn how to change Localhost to domain name in Xampp. Follow these steps and you’ll be able to do it yourself in no time.

If you’re familiar with websites or web development in general, you’ve probably come across the word localhost, which refers to your own computer. However, have you ever wondered how to convert localhost to a domain name for XAMPP or WAMP? For those who don’t know what XAMPP/WAMP is? It is basically software that provides a technical stack for website development, namely PHP, MySQL, Apache, PhpMyAdmin, and others.

Table of Content

What is localhost?

Localhost is a hostname that refers to the current computer that can access it. In short, localhost refers to your computer. Used to access network services running on the host (your computer) through the network feedback interface. For example, a locally hosted website can be accessed from a web browser using the URL http://localhost to display its home page.

Today in this tutorial I will show you how to convert localhost to a domain name.

Allow domain on the local computer:

Similar to similar software, is used to route the software to the local computer when XAMPP sets up the web server on your Windows computer. is the local computer address. localhost uses the IP address If you want to use a custom domain name instead of localhost on XAMPP, you must first allow the domain to have a local IP address of

Windows computers have a host file, an operating system file that maps hostnames to IP addresses. This allows the user to specify the IP address to use for the hostname or domain name without checking DNS. For more information, please see this tutorial to find and edit the host file in Windows 10.

You have now forwarded the custom domain to your local webserver. Follow the steps below to map the domain to a special folder for local websites configured with XAMPP.

Align the custom domain to (localhost).

Now you need to add your custom domain and pass it to the IP address which is the IP address of localhost.

  1. Go to Search >> Notebook Search >> Run as administrator
  2. In the editor window, select File >> Open
  3. Navigate to C:\Windows\System32\Drives\etc and set the file type from Text Document to All Files
  4. Open the host’s file. Note that the file has no extension
  5. Add your custom domain as described in the following example.


Change Localhost to the domain name for XAMPP

Here is a custom domain and can be anything.

If you are not using XAMPP and you are using other backend technologies like Node.js, Django, etc. just add this line to the host’s file and done. Just go to your domain and port, in this case, or

  • You are ready. will now redirect to localhost.
  • However, if you want to add a custom domain along with localhost. Follow the rest of the lesson.
  • Add virtual hosts to httpd-vhosts.conf file on Apache server
  • Launch Notepad >> File> Open
  • Navigate to C:\xampp\apache\conf\extra. Make sure that you change to the correct
  • directory where you have installed XAMPP.

Open httpd-vhosts.conf and edit.

Add the code below.

This is for localhost

DocumentRoot “C:\xampp\htdocs\mydomain”
Server name
ServerAlias ​​

Requires everything provided

This is for custom domain

change localhost to the domain name for XAMPP

Now restart your Apache server and test it by visiting the custom domain of the domain you set up. If you have followed the steps carefully, you should not make any mistakes.

May Be You Like: Best WordPress Hosting for Multiple Affiliate Blog

How to change Localhost to domain name in Xampp Video

Credit: Imran Nazir

If you encounter any errors, please write them in the comments below.

Share your love
Sathish Jadhav
Sathish Jadhav

Meet Sathish Jadhav, a Dubai-based Freelance Digital Marketer offering top-notch web design, SEO, PPC, and social media marketing services. With a strong background in digital marketing, Sathish delivers exceptional results, helping businesses succeed online and surpass their competition. Unlock your online potential and connect with him today.

Articles: 138

Leave a Reply

Your email address will not be published. Required fields are marked *