How to Change localhost to a Custom Domain Name in XAMPP/WAMP (Windows)?

Nil

  • April 20, 2022
  • How To , Hosting , Windows

Changing localhost to custom domain name in XAMPP & WAMP

Domain names are always easy to remember and also give a professional look in local development instead of typing IP (127.0.0.1) or localhost and file directory.

By default while using local development server WAMP and XAMPP, you have to type localhost/{directory_of_web_application} or 127.0.0.1/{directory_of_web_application} in browser. In XAMPP/WAMP, there is no direct one-click method like in localWP to create a custom domain.

This tutorial will help you to create an easy-to-use custom domain URL in WAMP and XAMPP.

Let’s say you have your local application on localhost/mylocalapp. After following this tutorial you can access that application with mylocalapp.test or any domain name you would like.

Table of Contents

Steps to convert localhost into a custom domain in XAMPP in Windows

To set up a custom domain in localhost we have to apply the change in three places: Setting local development in XAMPP & identifying directory, pointing a custom domain to local computer from Windows host file, and redirecting the domain to a specific application folder through VirtualHost.

Locate Application directory (folder)

Generally, application/website files are located inside htdocs in the main XAMPP folder. For localhost/mylocalapp directory C:/xampp/htdocs/mylocalapp.

Update Windows Host file

Now, Update the Windows host file to tell the local DNS to redirect your domain into your local computer (same Computer).

  • Step 1 : Go to C:\Windows\System32\drivers\etc and edit hosts file ā€œas Administratorā€. [ For that open, any text editor in administrator mode then navigate to hosts file.]
  • Step 2 : Add 127.0.0.1 and custom domain at the end of file.

You can add as many domain names as you want by separating them with space. Or can add on each new line like: 127.0.0.1 mylocalapp.local

  • Step 3 : Save and close.

After getting a request on the same localhost server, let’s tell which application to execute on a particular domain request with a virtual host.

Update Apache virtual host.

Virtual host redirects a particular domain to a specific application file directory in the server.

  • Step 1 : Go to C:\xampp\apache\conf\extra and open httpd-vhosts.conf file.
  • Step 2 : Add virtual host configuration for particular URL at the end of file.

You can add multiple alias names (domain name) by separating with space or can add another ServerAlias line in the new line.

  • Step 3: Save and close.

Now, your custom domain for local applications is ready.

  • 10 Best WordPress Themes for 2022 .
  • Top 10 Best Domain Registrars [2022]

Steps to convert localhost into a custom domain in WAMP in Windows

Now, we can easily add a custom domain in WAMP from Graphical Interface.

  • After starting WAMP server, visit localhost in browser and click “Add a Virtual Host” on left bottom corner.

Changing localhost to custom domain in WAMP server

  • Then, add custom domain in “Name of Virtual Host” field and your local application folder path in “VirtualHost folder” field. And, click on “Start the creation of the VirtualHost”.

Adding custom domain to WAMP Virtual host

  • Now, restart the DNS server. Right click on WAMPserver icon on taskbar tray. Go to Tools and click on “Restart DNS”. Now your custom domain is configured an ready to use.

Why should you use .local & .test instead of .com domain in localhost?

When using already available domain extension suffixes like .com, .net, .dev, and more, there is a chance domain may already be registered and hosted on the internet and may conflict while browsing these real domains with your local setup.

So, it’s always better to use .local and .test in the local test environment as they are special-use domain names reserved by the IETF (Internet Engineering Task Force) for these scenarios and can’t be registered in the domain registrar .

If you have any confusion following this tutorial or any topics on Nil Tutorial, donā€™t hesitate to ask in the comment section. You can also reach me on Twitter .

9 thoughts on “How to Change localhost to a Custom Domain Name in XAMPP/WAMP (Windows)?”

' src=

Can I provide the servername without a dot i.e. mylocalapp instead of mylocalapp.local

' src=

You can create a domain name like localhost without an extension but it’s recommended to use .local and .test extensions to prevent possible conflict.

' src=

how to change ip server to domain in a real linux server?

Configure DNS A record mapping your domain into IP. You can manage DNS in the domain registrar panel. Also, you can use third-party nameservers like Cloudflare.

' src=

I changed my localhost to a custom domain name but it isn’t working …

Did you follow all steps mentioned in the article? And, is there any error or notice?

' src=

If I configure my domain name on my computer, which means it’s not accessible from anyone from the internet? Outside from the internet, If they want to access my content locally on my computer then I’ll have to supply them my pubic IP address (assuming I already configured my localhost to do so).

Yes, that is one way. You can also create a live URL for your local project using tools like the live link option of localwp . Some other tools and services also provide this feature: ngrok, localtunnel, BrowserStack, PageKite, boringproxy.

' src=

How to do the same on ios?

Leave a Reply Cancel reply

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

Save my name, email, and website in this browser for the next time I comment.

DEV Community

DEV Community

MMJ

Posted on Jun 13, 2021 • Updated on Jul 13, 2021

Sharing Local Server with Local Network (XAMPP)

In this simple step-by-step tutorial Iā€™m gonna explain how to share a local server (using XAMPP) with your local network in order to share DB, folders in httpdocs (local websites) and even start a XAMPP server on other machines running a local website that connects to a DB in the shared server . That last feature was the most important for me to achieve because I needed to work with a teammate on the same project, each one on a local copy but both connected to the same DB, managing changes with a git repository on Github. I found many similar tutorials online, but none was merging all I needed, so I decided to share my solution. Hope this can help even with different environment too.

STEP 1 ā€“ Getting static IPs for your machines

Thatā€™s not mandatory, but itā€™s the easiest and safest way to go. There are many ways to do so and internet is full of good tutorials. Hereā€™s a video: https://bit.ly/3zrB8HA And hereā€™s an article: https://bit.ly/2So11HC

STEP 2 ā€“ Change some XAMPP settings

After setting static IP addresses letā€™s make an example assuming we have a machine sharing its XAMPP (which Iā€™ll name ā€œserverā€ from now on) with IP 192.168.1.10 and another machine that will connect to the server (which Iā€™ll name ā€œclientā€ from now on) with IP 192.168.1.11

You need to change some XAMPP server configuration in the server machine. I suggest to make a backup copy of the files we are going to change. To reach the files you need to change, click on the Apache Config button in the XAMPP Control Panel as the image shows.

Alt Text

FIRST CHANGE : Now click on the httpd.conf and look for the part where it says

Here you have to add the local IP address of your ā€œserverā€, in this example 192.168.1.10. So, weā€™ll have

SECOND CHANGE : Open again the Apache Config button in the XAMPP Control Panel and click on httpd-xampp.conf Here we have to find where it says

We have to grant access, so we need to change it like this:

Step 3 ā€“ Firewall Settings

This can be different basing on your machine and firewall settings. Anyway, port 80 must be reachable from client but not open for anybody from anywhere. To achieve that I had to turn off a blocking rule and adding one to open port 80 . To do so open your firewall configuration, in this example I use windows firewall: click on windows logo, type ā€œfirewallā€ then press enter. In next window click on advanced settings . Then click on Inbound rules and look for a blocking rule (red prohibition sign) that says ā€œApache HTTP Serverā€ . If you find it, right click on it and choose disable . After that, staying on Incoming rules section, click on New ruleā€¦ in the upright corner. In each step of the wizard to create rule choose:

  • All programs
  • Protocol: TCP, Local port: Specific port ā€“ 80
  • Remote IP address: 192.168.1.11 (client machine)
  • Allow the connection
  • Uncheck Public
  • Give name and description + finish button

Alt Text

At this point if server machine starts XAMPP, the client can reach the server using its browser using the url http://192.168.1.10 as it was on the server machine, so it can reach phpadmin and DBs ( http://192.168.1.10/phpmyadmin ) or any website in the htdocs folder ( http://192.168.1.10/AnyLocalWebsiteFolder ). Anyway, it could be still impossible for any machine to start its own XAMMP, open a local copy of the same project and connect it to the DB on the server machine. To make it work, we need another step.

Step 4 ā€“ Adding PhpMyAdmin Users

We finally have to add a user with all privileges for each machine (server included) in PhpMyAdmin, in our example we have to add [email protected] and [email protected]

Now each machine can work freely on their local copy of the project, using a git versioning on a remote common repository, connecting on a single local DB on the server machine. The snippet defining constants to build the connection will be the same for every machine

Client machine(s) will run its XAMPP working on its local copy and checking the results on its local http://localhost/LocalWebsiteFolder , but connection will be correctly set on the server DB.

I'm aware that there could be many other ways to achive what I've described, if you know any and you think it's even easyer, please let me know. This is just the solution I came up with after smashing my head to the wall countless times. Anyway, I hope it helps.

Top comments (1)

pic

Templates let you quickly answer FAQs or store snippets for re-use.

souarikarim profile image

  • Joined Dec 24, 2020

Thank you for this great content !! you saved me a lot of time !

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink .

Hide child comments as well

For further actions, you may consider blocking this person and/or reporting abuse

codelikeagirl29 profile image

Badges for Markdown

Lindsey Howard - Dec 25 '23

vincelwt profile image

ā­ 6 Open-Source Vector Databases to Power Your AI App šŸ”—šŸ’½

Vince Lwt - Dec 22 '23

raj00114 profile image

Essential GitHub Repositories for Mastering Machine Learning

Adarsh Raj - Dec 4 '23

kasuken profile image

The Power of Atomic Commits in Git: How and Why to Do It

Emanuele Bartolesi - Dec 22 '23

Once suspended, mmj will not be able to comment or publish posts until their suspension is removed.

Once unsuspended, mmj will be able to comment and publish posts again.

Once unpublished, all posts by mmj will become hidden and only accessible to themselves.

If mmj is not suspended, they can still re-publish their posts from their dashboard.

Once unpublished, this post will become invisible to the public and only accessible to MMJ.

They can still re-publish the post if they are not suspended.

Thanks for keeping DEV Community safe. Here is what you can do to flag mmj:

mmj consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy.

Unflagging mmj will restore default visibility to their posts.

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Localhost access is working but when i use Ipaddress access then it is not working - xampp

I installed XAMPP and I started the served. When I type "localhost" in the browser URL it is working fine. When I type my machine IP address where the XAMPP resides that is "172.31.1.3" it is not working.

Can any one help me in this regard.

S.Venkatesan's user avatar

The Apache server needs to be told what ethernet devices to listen for connections. It's probably by default only listening on the localhost, you can add entries to so that it will also listen on 172.31.1.3.

Take a look at the Apache docs .

You'll probably need to do the following:

  • Stop the XAMPP server, if it is running already.
  • Open the file [XAMPP Installation Folder]/apache/conf/httpd.conf .
  • Search for the string *Listen 80 *(I'm assuming that your XAMPP was using the port 80.
  • Otherwise, just search for the string 'Listen'). This is the port number which XAMPP uses.
  • Change this 80 to 172.31.1.3:80.
  • Now save and re-start XAMPP server and you are done.

slm's user avatar

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged xampp ..

  • The Overflow Blog
  • Exploring the inclusive tech revolution sponsored post
  • Would you trust an AI bot to find the fix for vulnerabilities in your code?
  • Featured on Meta
  • Site maintenance - Saturday, February 24th, 2024, 14:00 - 22:00 UTC (9 AM - 5...
  • Upcoming privacy updates: removal of the Activity data section and Google...

Hot Network Questions

  • Why is the key typically the first and/or last note (or chord) of a song?
  • What happens to mysql synchronous replication when read replica can't respond?
  • How to apply outlines to edges of faces in a mesh?
  • Publishing two papers at the same time
  • How to code defensively in Bash for unhandled runtime errors within logical expressions?
  • Impedance matching and termination resistor
  • Isomorphic finite fields of a skew field
  • How can the ECtHR judgement on encryption be reconciled with the UK's Online Safety act?
  • Lots of electrical noise at boost converter output
  • Are there any good-aligned Sexuality-related Outsiders that aren't arshea?
  • Assign a different color to each face using geometry nodes
  • Statistically significant difference
  • How to prevent accidental execution of potentially harmful commands (e.g. reboot)
  • Impact of Ryan and Heninger's CRYPTO 2023 paper on post quantum cryptosystems
  • Why does the exported video still have control buttons, causing the screen to be too large?
  • Does psychophysical harmony strongly point toward theism?
  • When was Doctor Who first broadcast in the USA?
  • How to account for the difference between the sexes in a mortality rate
  • Can I stack optocouplers in series to make a higher specification part?
  • How should I reconcile the concept of "no means no" when I tease my 5-year-old during tickle play?
  • Silverback Bottom Bracket Replacement
  • Combinations of indistinguishable marbles
  • why does Blender render an image in the compositor?
  • Legal definition of a "criminal record"

change localhost ip address xampp

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Change MySQL from looking at LocalHost to different IP on local machine

Thanks to this article , I was linked to this article , which, after giving my PC two IPAddresses , was able to have IIS and Apache living happily on the same PC at the same time.

I also added the following lines in my hosts file so that IIS could run normal w/o interfering with my playtime:

192.168.1.99 localapache 192.168.1.2 localhost #Required since I added two ip addresses

I want my Apache/PHP/MySql to go to .99 and IIS to use .2.

enter image description here

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

The only changes to mysql that I've made is adding the following line to my.ini:

bind-address="192.168.1.99" #.99 is my Apache address

Is there some other mysql configuration change I need to make so that mysql looks to 192.168.1.99 and not localhost?

Community's user avatar

MySQL would only let me connect to it if I removed the entry in my hosts file listed above. I also removed the bind-address configuration in my my.ini so that it would bind to to 127.0.0.1. Basically, I put my box back in the state it would be in by default for connecting to MySql.

From there I ran the following commands:

I understand having no password for root is not recommended.

I also understand the command above allows anyone in the world to connect to mySql. That's fine. It's a dev machine sitting behind a firewall; no worries there.

So apparently I should have started with the MySQL install first and granted the privileges I wanted before I made IP changes.

I'm sure there's a smarter way, but I now have IIS, SQL Server, Apache and mySql living in harmony on my machine; which is exactly what I wanted.

No need for virtual machines.

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged mysql windows-7 xampp ..

  • The Overflow Blog
  • Exploring the inclusive tech revolution sponsored post
  • Would you trust an AI bot to find the fix for vulnerabilities in your code?
  • Featured on Meta
  • Site maintenance - Saturday, February 24th, 2024, 14:00 - 22:00 UTC (9 AM - 5...
  • Upcoming privacy updates: removal of the Activity data section and Google...

Hot Network Questions

  • How can the ECtHR judgement on encryption be reconciled with the UK's Online Safety act?
  • How should I reconcile the concept of "no means no" when I tease my 5-year-old during tickle play?
  • Were Mr. Darcy and Mr. Bennet formally equal in rank?
  • EU citizen making unofficial crossing from non-Schengen EU country to Schengen EU country
  • How do water controlling spells work on water in pipes?
  • How to identify the keys to power in a government?
  • Impedance matching and termination resistor
  • How can the Klein-Gordon equation have negative-energy solution if its Hamiltonian is positive-definite?
  • Why are my new switches operating in reverse?
  • Assign a different color to each face using geometry nodes
  • Strikethrough text and formula in LaTeX
  • How can I make two hearts work?
  • What are the techniques that delay the formation of shock wave over wing?
  • Unable to understand what confidence interval means
  • Lots of electrical noise at boost converter output
  • BJT B-E Zenering: whither the collector?
  • Combinations of indistinguishable marbles
  • Is this diesel gun concept feasible?
  • How to fit a product of linear expressions?
  • What is the better rendering of colossians 2: 14?
  • why does Blender render an image in the compositor?
  • Assigned to Review a Paper I Previously Reviewed
  • Does psychophysical harmony strongly point toward theism?
  • Silverback Bottom Bracket Replacement

change localhost ip address xampp

  • PRO Courses Guides New Tech Help Pro Expert Videos About wikiHow Pro Upgrade Sign In
  • EDIT Edit this Article
  • EXPLORE Tech Help Pro About Us Random Article Quizzes Request a New Article Community Dashboard This Or That Game Popular Categories Arts and Entertainment Artwork Books Movies Computers and Electronics Computers Phone Skills Technology Hacks Health Men's Health Mental Health Women's Health Relationships Dating Love Relationship Issues Hobbies and Crafts Crafts Drawing Games Education & Communication Communication Skills Personal Development Studying Personal Care and Style Fashion Hair Care Personal Hygiene Youth Personal Care School Stuff Dating All Categories Arts and Entertainment Finance and Business Home and Garden Relationship Quizzes Cars & Other Vehicles Food and Entertaining Personal Care and Style Sports and Fitness Computers and Electronics Health Pets and Animals Travel Education & Communication Hobbies and Crafts Philosophy and Religion Work World Family Life Holidays and Traditions Relationships Youth
  • Browse Articles
  • Learn Something New
  • Quizzes Hot
  • This Or That Game New
  • Train Your Brain
  • Explore More
  • Support wikiHow
  • About wikiHow
  • Log in / Sign up
  • Computers and Electronics
  • Computer Networking

How to Set up a Personal Web Server with XAMPP

Last Updated: January 12, 2024

This article was written by Tyrone Showers and by wikiHow staff writer, Travis Boylls . Tyrone Showers is a Technologist and the Co-owner of Taliferro Group, an IT consulting company based in Seattle, Washington. With over 35 years of professional experience, he specializes in API Design, e-Commerce, Operational Efficiency, and website development. He has a B.S. in Computer Science from DeVry Institute of Technology. This article has been viewed 224,976 times.

XAMPP is one of the most robust personal web server applications. It is available for Linux, Windows and Mac OS environments. It is also very easy to install, configure and use. Using a personal web server allows you to work locally from your own laptop or PC for development purposes. It provides you a secure, private environment for developing that can be shared later. It allows you to configure all of the necessary components of a web server for you without the complication. This wikiHow teaches you the basic setup and configuration steps needed to set up your own personal web server using XAMPP.

Installing the Web Server Application

Step 1 Go to https://www.apachefriends.org/index.html...

  • If your download does not start automatically, click the green text that says click here at the top of the page.

Step 3 Double-click the install file.

  • If you receive an alert that informs you that your Antivirus software may interfere with the installation, temporarily disable your antivirus software and click Yes to continue the installation.

Step 4 Click Next.

  • On Mac, when you see the XAMPP icon with an arrow pointing to the Applications folder, click and drag XAMPP.app to the Applications folder as indicated to copy it to your Applications folder.

Tyrone Showers

Tyrone Showers

XAMPP makes setting up a personal web server on your own computer easy. Getting Apache installed and running is the first step. Then, be sure to change that default password for the root user in PHPMyAdmin ā€” security matters. You can also set up virtual hosts to test sites for different domains, check that PHP is working right, and disable any modules you don't need to trim things down. And remember to keep XAMPP updated to stay safe and efficient.

Step 7 Continue clicking Next until XAMPP starts to install.

Configuring your Personal Web Server

Step 1 Double-click on the newly created XAMPP icon.

  • On Mac, click Start under the General tab. Then click the Services tab and select Apache and click Start . Then select MySQL and click Start .
  • you may see a couple of Windows Messages after clicking Start.
  • There are times when you may click on ā€œStartā€ to start the Web Server and it does not want to start. This is usually due to another program using the same port as the webserver. The most common conflict is with Skype. If your web server will not start and you are running Skype, close Skype and try to start the webserver again.
  • To change the port number, click Config next to "Apache" and open the "httpd.conf" file. Then change the port number next to "Listen" to any free port number. Then open the "httpd-ssl.conf" file under "Config" and change the port number next to "Listen" to any free port number. Click Netstat to see a list of what port numbers are being used by each program. [2] X Research source

Step 3 Click Admin next to Apache.

  • Click Databases to see a list of databases.
  • Enter the name of a database where it says "Database name".
  • Click Create .

Step 6 Add a password for your database (optional).

  • Click User accounts .
  • Click Edit Privileges next to "Local Host" with the username "root".
  • Click Change password .
  • Enter a password in the spaces provided.
  • Click Go in the lower-right corner.

Step 7 Fix the

  • Click Explorer to the right in the XAMPP Control Panel.
  • Open the "phpMyAdmin" folder.
  • Open the "config.inc.php" file in NotePad or another text editor.
  • Change "config" to "cookie" next to "$cfg['Servers'][$i]['auth_type'] = 'config';"
  • Change "true" to "false" next to "On $cfg['Servers'][$i]['AllowNoPassword'] = true;"
  • Click File .
  • Click Save .

Expert Q&A

Tyrone Showers

  • Regularly update XAMPP. Thanks Helpful 0 Not Helpful 0

change localhost ip address xampp

  • Don't make any changes that will allow access outside the local network when you first start out. Implementing security measures should be done once you're comfortable with the tool. This includes configuring firewalls and using secure passwords. Thanks Helpful 0 Not Helpful 0

Video . By using this service, some information may be shared with YouTube.

You Might Also Like

Watch a Music Video on Spotify

Expert Interview

change localhost ip address xampp

Thanks for reading our article! If youā€™d like to learn more about computer networking and servers, check out our in-depth interview with Tyrone Showers .

  • ā†‘ https://pureinfotech.com/install-xampp-windows-10/
  • ā†‘ https://www.ionos.com/digitalguide/server/tools/xampp-tutorial-create-your-own-local-test-server/

About This Article

Tyrone Showers

1. Download the XAMPP installer from https://www.apachefriends.org/index.html . 2. Double-click the installer file and follow the instruction to install XAMPP. 3. Double-click the XAMPP icon to open the XAMPP Control Panel. 4. Click Start next to "Apache" and "MySQL" to start the local servers. 5. Click Admin next to "Apache" to open the Apache Dashboard. 6. Click the icons at the bottom to see a list modules you can use with XAMPP. 7. Click Admin next to "MySQL" to open the myPHPAdmin dashboard. 8. Click "Databases" to see a list of local databases. 9. Enter the name of a new database name where it says "Database name" and click Create . Did this summary help you? Yes No

  • Send fan mail to authors

Is this article up to date?

change localhost ip address xampp

Featured Articles

25+ Pro Tips To Help You Truly Enjoy Life

Trending Articles

Everything You Need to Know to Rock the Corporate Goth Aesthetic

Watch Articles

Cook Fresh Cauliflower

  • Terms of Use
  • Privacy Policy
  • Do Not Sell or Share My Info
  • Not Selling Info

wikiHow Tech Help:

Tech troubles got you down? We've got the tips you need

  • Advertise with us
  • Explore by categories
  • Free Online Developer Tools
  • Privacy Policy
  • Comment Policy

How to setup a Virtual Host locally with XAMPP in Ubuntu

Carlos Delgado

Carlos Delgado

  • November 15, 2016
  • 136.4K views

Learn how to setup a virtual host easily using XAMPP in Ubuntu.

The usage of virtual hosts in xampp is the practice of running more than one web site (that targets local resources) on a single machine.

Virtual hosts are IP-based, meaning that you have a different IP address for every web site, or "name-based", meaning that you have multiple names running on each IP address. This practice using XAMPP comes in handy when you want to simulate a production environment (however working in dev environment) locally accessing to your project by a normal URL in the browser.

To setup a custom virtual, we need to follow these steps:

  • Allow the usage of the vhosts.conf file editing theĀ  httpd.conf file.
  • Now create a custom domain in the hosts file of the system ( /etc/hosts ).
  • Create your ownĀ virtual host.
  • Start apache.

Let's get started!

1. Allow the usage of custom virtual hosts

By default, xampp in ubuntu won't use the httpd-vhosts.conf file (the location of the virtual hosts), therefore we need to indicate that this file will be included during the runtime of apache. Open with your favorite code editor the httpd.conf file located tipically in /opt/lampp/etc or just execute the following command in your terminal to open a simple editor:

Now locate yourself in (about) the line 487 where you probably will find the following lines:

As you can see, the Include statement that includes the httpd-vhosts.conf file is commented . Proceed to modify the line uncommenting that line:

And you're ready to configure your custom vhost.

2. Create a custom domain in the hosts file of your system

You need to create a custom domain where our apache virtual host will point to. This domain will be normally an ip (127.0.0.xx based) and a custom name.

To start, edit theĀ  hosts file located in /etc using your favorite code editor, or just by executing the following Ā command in the terminal:

And proceed to add your custom host. In this example, our ip will beĀ  127.0.0.3 and the domainĀ  myawesomeproject . So finally, our hosts file will look like:

Save the file, and now the domain myawesomeproject is an alias for the local address 127.0.0.5 .

3. Create your first virtual host

Tipically, you need to create the virtual host in the httpd-vhosts.conf file located inĀ  /opt/lampp/etc/extra . Use your favorite editor to edit that file or just execute the following command to edit it in a terminal:

And create your own virtual host in this file. As shown in our custom domain in the vhost file of the system, the port that we are going to use is 127.0.0.5 , therefore our virtual host will be:

The deep and custom configuration of your VirtualHost is up to you. Save the file, and you're ready to test it.

4. Test your virtual host

To test it, in the folder /opt/lampp/htdocs/my-first-project , create a simple PHP file ( index.php ) thatĀ will contain the following PHP code:

Start apache, mysql (entire XAMPP) using the following command (or whatever the way you start apache and the other required services):

Navigate in your favorite browser to http://myawesomeproject/ Ā or http://127.0.0.5/ Ā andĀ you should get as output " Hello World " in the browser.

Happy coding !

Senior Software Engineer at Software Medico . Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Related Articles

How to configure a virtual host for a Laravel Project in Xampp for Windows

How to configure a virtual host for a Laravel Project in Xampp for Windows

  • September 25, 2017
  • 89.2K views

How to install and setup PrestaShop using Xampp in Windows

How to install and setup PrestaShop using Xampp in Windows

  • December 06, 2016

XAMPP Virtual Hosts works in Chrome and Firefox but doesn't work on Microsoft Edge Browser

XAMPP Virtual Hosts works in Chrome and Firefox but doesn't work on Microsoft Edge Browser

  • May 27, 2017
  • 10.9K views

How to fix SSH Host key verification failed, warning: remote host identification has changed in Ubuntu 18.04

How to fix SSH Host key verification failed, warning: remote host identification has changed in Ubuntu 18.04

  • April 05, 2020
  • 17.2K views

How to install XAMPP in Ubuntu 16.10

How to install XAMPP in Ubuntu 16.10

  • November 12, 2016

How to solve Xampp Error: Port 80 in use by another application (Skype) when starting Apache

How to solve Xampp Error: Port 80 in use by another application (Skype) when starting Apache

  • May 24, 2017
  • 13.1K views

Advertising

Free Digital Ocean Credit

All Rights Reserved © 2015 - 2024

XAMP Change Localhost To Domain

Follow the below steps to Change localhost to custom domain name in XAMP server

1) Open the file C:\Windows\System32\drivers\etc and edit ā€œas Administratorā€ => hosts file.

Add the below line and save the file.

127.0.0.1 phpcodez.com

2) Edit httpd-vhosts.conf file (In my system E:\xampp\apache\conf\extra and edit httpd-vhosts.conf )

Add the below lines and save the file

3) Restart XAMPP and url www.phpcodez.com will load content form e:/xampp/htdocs/phpcodez

4 thoughts on “XAMP Change Localhost To Domain”

It worked. Very thanks…

It worked. Very thanksā€¦

Hello, I enjoy reading all of your post. I like to write a little comment to support you.

Leave a Reply Cancel reply

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

Save my name, email, and website in this browser for the next time I comment.

Beginners' Guide

porka one

  • Tips & Trick
  • Programming

How to Change Xampp Localhost to Your Own Domain

How to Change Xampp Localhost to Your Own Domain

Hello everyone, back again at porkaone. Well on this occasion I will share a tutorial on how to change localhost on xampp's own domain address, as you wish. Curious?, let's follow the tutorial below.

Xampp is a software used to create local servers that can stand alone and support multiple operating systems. Using the apache server, php language, and mysql DBMS, so users do not need to install the necessary applications for each other. This application is very popular among web developers and very easy to use.

to access the local server address, you just use http://localhost then the xampp dashboard page will appear. But many people are wondering, how do you change localhost to the desired domain?. It's easy guys, you just need to change a few settings on the windows system, and the apache server.

How to Change Localhost Xampp Into Your Own Domain.

sahretech

You may like these posts

Post a comment.

Come on ask us and let's discuss together

Most Popular

How to Upload Images and Display them on Flutter

How to Upload Images and Display them on Flutter

How to Upload Image in Flutter & Save It in MySQL Database

How to Upload Image in Flutter & Save It in MySQL Database

How to Use Future Builder and Progress Indicator Flutter

How to Use Future Builder and Progress Indicator Flutter

Cara Merapikan File CSV Saat Dibuka di Excel

Cara Merapikan File CSV Saat Dibuka di Excel

Perbedaan Aplikasi dan Sistem Informasi yang Harus Kalian Tahu

Perbedaan Aplikasi dan Sistem Informasi yang Harus Kalian Tahu

  • application
  • computer science
  • data mining
  • data warehouse
  • how to work
  • internet marketing
  • library javascript
  • microsoft excel
  • microsoft office
  • pemrograman
  • pemrograman web
  • pengetahuan
  • programming
  • social media
  • tips & trick
  • tips dan trick
  • video editing
  • web programming

XDA Developers

How to install XAMPP on Windows 11

Quick links, how to install xampp on windows 11 and windows 10, how to use xampp on windows 11.

While Linux is a bit better for coding than Windows , you don't need to change your operating system to do most programming. You just need to have the correct tools. One of the most important of these tools is XAMPP, a cross-platform, open-source web server thatā€™s free to use. Youā€™ll want to use XAMPP as itā€™s easier than installing or configuring software like MariaDB on your own. It bundles MariaDB, MySQL, interpreters for PHP and Perl, and the Apache HTTP Server and creates a local server environment on your machine.

Fortunately, XAMPP is easy to configure and works well if you have a good laptop for development . If youā€™re on Windows 11 or Windows 10, the setup process is relatively easy. But if youā€™re unsure of where to begin, weā€™ve compiled a few step-by-step instructions to help you get started.

To install XAMPP, you must first download the app from the official website. After the download is complete, you need to launch the setup wizard and select all the components that you want to install with XAMPP. The process is the same for both Windows 10 and 11. Here are the exact steps to follow:

  • Head to the official XAMPP website .
  • Click the XAMPP for Windows button to download the latest version thatā€™s supported for Windows 11. Wait for the download to begin automatically.
  • After the download is finished, click the EXE file to launch the setup wizard, and click Yes when the confirmation box pops up.
  • Another warning box will pop up. Ignore this for now and click OK to continue with the installation. Close
  • Follow the instructions in the setup wizard to install XAMPP. When you reach the Select Components screen, check the boxes next to all the components you want to install (MySQL, FileZilla, Tomcat, Perl, and more). Click Next to continue.
  • After selecting the components, you'll be taken to the Ready to Install screen. Click Next .
  • After the installation is done, click Finish , and XAMPP will launch itself automatically. If not, youā€™ll find the app in your Start Menu. Close

Thatā€™s all there is to it. Youā€™ve now successfully installed XAMPP on your system and are ready to embark on your web development journey.

So, youā€™ve successfully installed XAMPP on your Windows 11 PC, but how do you use it? If youā€™re feeling a bit lost, hereā€™s everything you need to know about the interface:

  • To get started, click the Start button under the Actions column in front of Apache to start the Apache web server.
  • Similarly, click the Start button under the Actions column in front of MySQL to start the MySQL database.
  • In the Ports column, youā€™ll see the port numbers for both Apache and MySQL when the servers are running.
  • To check if everything is working properly, go to the web browser of your choice, type localhost in the address bar, and hit Enter . If you see the XAMPP welcome page, the Apache server is working properly. Close
  • Go through the dashboard to find FAQs and how-to guides to get started with XAMPP and PHP applications.

Getting started with web development

With XAMPP now seamlessly installed on your Windows 11 or Windows 10 system, youā€™re ready to start building a robust foundation for web development. Your learning journey doesnā€™t stop there, though, as youā€™ll have to get comfortable dealing with MySQL and PHP files, depending on what you plan on doing. The learning curve might be a bit steep, but youā€™ll handle it with a bit of perseverance. Good luck!

How to install XAMPP on Windows 11

COMMENTS

  1. How do I change the IP address in XAMPP for Windows?

    How do I change the IP address in XAMPP for Windows? Ask Question Asked 11 years, 7 months ago Modified 6 months ago Viewed 95k times 11 I've been trying to figure out how I can change my server config for XAMPP so that it doesn't have a memory fault when both Windows and the server are trying to access localhost at the same time.

  2. How to change IP of localhost into URL with XAMPP

    1 Answer Sorted by: 2 You can do it via adding the following line on your host file. Path: C:\Windows\System32\drivers\etc Entry on Your Machine # localhost name resolution is handled within DNS itself. 127.0.0.1 myproject.com #ACCESS FROM YOUR MACHINE. Entry on another machine

  3. How to Change Localhost to Custom Domain in XAMPP in Windows?

    Step 1: Go to C:\Windows\System32\drivers\etc and edit hosts file "as Administrator". [ For that open, any text editor in administrator mode then navigate to hosts file.] Step 2: Add 127.0.0.1 and custom domain at the end of file. 127.0.0.1 mylocalapp.test mylocalapp.local You can add as many domain names as you want by separating them with space.

  4. ip address

    Don't redefine the meaning of localhost. You'll break things in surprising ways. Instead, look at the -L and -R options in ssh(1). They make it easy to redirect a port on the local machine to the IP address and port of a remote machine. Plus the tunnel is secured by SSH. Note that these tunnels are not necessarily specific to ssh/shell traffic.

  5. xampp

    4 Answers Sorted by: 16 To access the server from itself, use http://localhost/ or http://127.0.0.1/. To access the server from a separate computer on the same network, use http://192.168.X.X where X.X is your server's local IP address.

  6. Sharing Local Server with Local Network (XAMPP)

    STEP 1 - Getting static IPs for your machines That's not mandatory, but it's the easiest and safest way to go. There are many ways to do so and internet is full of good tutorials. Here's a video: https://bit.ly/3zrB8HA And here's an article: https://bit.ly/2So11HC STEP 2 - Change some XAMPP settings

  7. How to change IP address to point to localhost?

    1 Answer Sorted by: 23 Hosts file can only be used to associate a domain name with an IP; it cannot map IP to IP. Altering IPs can be done by a firewall. On Linux, the default firewall is controlled by iptables commands. "man iptables" is the documentation. Google "explain iptables" for introductory explanations. Some links:

  8. Localhost access is working but when i use Ipaddress access then it is

    1 Answer Sorted by: 2 The Apache server needs to be told what ethernet devices to listen for connections. It's probably by default only listening on the localhost, you can add entries to so that it will also listen on 172.31.1.3. Take a look at the Apache docs. You'll probably need to do the following:

  9. How do I allow remote access to mysql using xampp?

    To me, this is easier and quick: Go to PhpMyAdmin and then: localhost/phpmyadmin -> User accounts -> Edit privileges -> Login Information. Change Host name drop down to Any host or type any IP 192.168..3 or even with masking 192.168..%. And click the button Go. 3. Restart MySQL. More details here.

  10. windows 7

    1 Answer Sorted by: 0 Got it. MySQL would only let me connect to it if I removed the entry in my hosts file listed above. I also removed the bind-address configuration in my my.ini so that it would bind to to 127.0.0.1. Basically, I put my box back in the state it would be in by default for connecting to MySql.

  11. How to Set up a Personal Web Server with XAMPP (with Pictures)

    2. Double-click the installer file and follow the instruction to install XAMPP. 3. Double-click the XAMPP icon to open the XAMPP Control Panel. 4. Click Start next to "Apache" and "MySQL" to start the local servers. 5. Click Admin next to "Apache" to open the Apache Dashboard. 6. Click the icons at the bottom to see a list modules you can use ...

  12. Fixing the IP address in Xampp localhost

    34 Share Save 28K views 7 years ago When I was reading my localhost ip_address it was showing ::1 whereas generally it shows 127.0.0.1 ...more ...more How to fix localhost and phpmyadmin...

  13. How to Change localhost to a Domain Name in XAMPP on Windows

    How to Change localhost to a Domain Name in XAMPP on Windows The Next Code 829 subscribers 78K views 6 years ago ...more ...more š—¦š—¼š—²š—»š—“ š—¦š—¼š˜‚š˜† Hey Guys,Every new comer web developer...

  14. How to setup a Virtual Host locally with XAMPP in Ubuntu

    This domain will be normally an ip (127.0.0.xx based) and a custom name. To start, edit the hosts file located in /etc using your favorite code editor, or just by executing the following command in the terminal: sudo gedit /etc/hosts. And proceed to add your custom host. In this example, our ip will be 127.0.0.3 and the domain myawesomeproject ...

  15. How to change localhost in XAMPP to Domain Name

    How to change localhost in XAMPP to Domain Name -----Is a free online learning program that introduces methods and h...

  16. XAMP Change Localhost To Domain

    Follow the below steps to Change localhost to custom domain name in XAMP server 1) Open the file C:\Windows\System32\drivers\etc and edit "as Administrator" => hosts file. Add the below line and save the file. 127.0.0.1 phpcodez.com 2) Edit httpd-vhosts.conf file (In my system E:\xampp\apache\conf\extra and edit httpd-vhosts.conf )

  17. How to Change Xampp Localhost to Your Own Domain

    How to Change Localhost Xampp Into Your Own Domain. 1. Open C:\Windows\System32\drivers\etc then open the hosts file 2. Add a new domain. Example domain: privateserver.com or look at the picture below Note: Usually the file will refuse to be saved.

  18. How to Change localhost to a Domain Name in XAMPP on Windows

    How to Change localhost to a Domain Name in XAMPP on WindowsIn this tutorial I am going to show you how to change localhost to a desired custom domain name ...

  19. How to install XAMPP on Windows 11

    Head to the official XAMPP website.; Click the XAMPP for Windows button to download the latest version that's supported for Windows 11. Wait for the download to begin automatically. After the ...

  20. xampp

    How to change a localhost url to ip in wordpress? Ask Question Asked 10 years, 7 months ago Modified 11 months ago Viewed 28k times 3 I am developing a site using wordpress, MySQL and Xampp. The current url is like localhost/wordpress/sitename .