Mobile app version of vmapp.org
Login or Join
Bryan171

: How to map a file path to a ip address I want to map a path to a domain and the most easy way i can think of is to try to map a path a ip and map that ip to a domain in the windows

@Bryan171

Posted in: #Dns #Localhost

I want to map a path to a domain and the most easy way i can think of is to try to map a path a ip and map that ip to a domain in the windows hosts file.But i don't know how to map a path to a ip.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

What you want is not possible. I'm assuming you're wanting to use a web browser to navigate to some file. The main problem is that an IP address represents a computer on a network (more specifically, a single network connection, of which there could be many of in a single server), and not a file.

That said: if what you're wanting is for some user to type domain.com and for some file to be shown, you'll need to setup a web server to respond to requests on port 80 of that computer. Apache is the most used for this, and can be set up in testing and development with installers such as XAMPP (installs nicely on multiple operating systems).

For the domain aspect, if you're planning on using a public domain on the internet you'll need to register that somewhere. Then need to create an A record for the domain that points to your IP address. Your domain registrar should likely provide this service for you.

Alternatively, if you're just doing this on your local machine for development purposes, or a local network you can use the Windows hosts file to mimic the A record mentioned above.

Once you've got that done, to "map the path" to the IP address/hostname as you want, you'll need to configure Apache (or whatever web server you decide to use) from where on the computer to serve files from. Apache allows you to configure what are called Virtual Hosts which allow you to serve files from different locations on the machine depending on the hostname requested. So for example, the same computer can reply to testdomain.local and realdomain.com with different content, though they're both coming from the same IP address.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme