I am wanting to change the root address of my domain to 31.xx.xxx.xx/folder/. How can I go about doing this?

I know that within the "zone file" I can edit the "A(host)" to the ip 31.xx.xxx.xx and that will work but I can not assign it as a folder!

  • 1
    This question doesn't make sense - DNS has (essentially) one job, converting names to numbers. Beyond that it's all down to what's listening. I.e., your web server etc – Dan Dec 28 '14 at 15:09
  • How can I do it with my webserver? – maxisme Dec 28 '14 at 15:15
  • I have no idea. – Dan Dec 28 '14 at 15:20
  • I wish I could post a link... but I suggest you read Chapters 1-5 of the book DNS and BIND, then reformulate your question. – milli Dec 31 '14 at 17:28

What you're asking is impossible. DNS only maps domain names to IP addresses, like to allow a browser to find the web server (or to allow email software to find the target SMTP server, and so on). Next, the browser will tell the server for which domain it wants the web site; see What exactly happens when you browse a website in your browser?

Likewise, you cannot map some specific URL to another server, or map a domain to a specific port.

If your web server needs to handle requests for multiple domains, you need something called "virtual hosting", to map domains to folders. If you only have one domain, you somehow need to tell your web server to set the root of the website to the specific folder.

  • Although I agree with you, this is technically (and stricto sensu) not entirely true. You can perform a pseudo mapping to ports using an SRV record (if the application layer of a client supports SRV records of course); likewise, DNS servers are not only used to map domain names to IP addresses (MX records are one example). – NaeiKinDus Dec 28 '14 at 16:33
  • The only application that widely uses SRV records is Microsoft Active Directory. Not much else uses them though -- e.g., some SIP phones -- despite their universal design for better load balancing & redirection. So they could be used for web services, but no browsers implement SRV lookups for HTTP services or other services. – milli Dec 31 '14 at 17:27
  • Thank you for telling me to look into virtual hosting! I have since found this tutorial, which worked perfectly! digitalocean.com/community/tutorials/… – maxisme Jan 1 '15 at 1:50

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.