1

I host a website on a local network with XAMPP. I usually access it with the IP address on another device.
How can I host my website on a domain like website.local ?

4
  • Use multicast DNS (mDNS). What you need to set it up is depends on the platform you’re running the webserver on (which you did not mention).
    – StarCat
    Oct 10 '20 at 19:02
  • @StarCat I'm running Apache on windows
    – J. Dove
    Oct 10 '20 at 19:16
  • On what Operating System?
    – StarCat
    Oct 10 '20 at 19:16
  • @StarCat windows
    – J. Dove
    Oct 10 '20 at 19:18
0

The domainname does not matter. The other device must be able to resolve the name, so edit the /etc/hosts file on the other device and add a line like:

<wepserver-ip> <domain-name>

For example:

192.168.1.20   www.google.com

On Windows you will find the hosts file in %systemroot%\system32\drivers\etc folder.

1
  • Already tried that, the website will be accessed by multiple devices. Some of them are mobile devices and sometimes new users will connect to the network. So that solution doesn't work.
    – J. Dove
    Oct 11 '20 at 6:05
0

You should be able to use multicast DNS (mDNS) for this purpose. To do that, you will need to set up mDNS on your computer. It seems to be a bit tricky to configure mDNS on Windows, and you might need to download Bonjour.

This question previously asked on SuperUser may provide some insights into how to solve your problem: How can I set up a 'local' domain so that everyone on my local network can view a locally hosted site?

Alternatively, you can try building an actual DNS server. Many routers have support for DNS and you may be able to add entries to it. The specific method depends on your router.

2
  • I'll checkout Bonjour then.
    – J. Dove
    Oct 11 '20 at 11:25
  • Juan I've got no clue on setting up bonjour
    – J. Dove
    Oct 11 '20 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.