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
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:
On Windows you will find the hosts file in %systemroot%\system32\drivers\etc folder.
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.