Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Use Custom Domain Instead of Localhost in XAMPP

In this post, you’ll learn how to create and use a Custom Domain name (i.e. example.com) instead of localhost in XAMPP.

Let’s get started!

Map the custom domain to localhost

Run Notepad as administrator and open the C:\Windows\System32\drivers\etc\hosts file.

Map the desired Custom Domain to localhost to avoid any domain conflicts.

You may hear that it’s better to have a .local domain because it reflects the environment you’re on and that’s a good argument.

However, I found that it didn’t suit me well because the browser I’m using instead of directly accessing the domain when I type it in the address bar, searches it in the search engine instead.

I find it pretty annoying, so I’m sticking to a .com domain.

But you may choose any domain you’d like, it doesn’t really matter.

Let XAMPP know about the domain

The next step is to tell XAMPP about the custom domain.

Open up C:\xampp\apache\conf\extra\httpd-vhosts.confand add the following chunk of code:

There are many customizations you can do right here.

For example, you can add a port if you want to access the domain like that.

Or you can add a certificate to have encryption.

But I think these are topics for another video, so let’s keep it short and sweet.

Save the file, restart the Apache and navigate to the domain.

That’s it!


Let me know what you think about this article through comments below, or on Twitter at @pelu_carol.

If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.



This post first appeared on Neutron Dev, please read the originial post: here

Share the post

Use Custom Domain Instead of Localhost in XAMPP

×

Subscribe to Neutron Dev

Get updates delivered right to your inbox!

Thank you for your subscription

×