-1

In my DNS settings, I want to point this website domain - www.websiteA.example to the following IP address which has a path http://xxx.xxx.xxx.xxx/pathA (this is a VPS, if it makes any difference)

Is this possible?

If so can you please provide more information on how I can achieve this?

Patrick Mevzek
  • 9,273
  • 7
  • 29
  • 42
pedron
  • 1
  • If you want to avoid a lot of pain in the future, avoid using IP addresses in URLs. Specially for HTTPS ones, but even for HTTP one. – Patrick Mevzek Nov 12 '20 at 02:10

2 Answers2

3

That's not possible, DNS only handles mappings between host or domain names and IP addresses; the path only makes sense for web sites, it's managed by the web server and DNS has nothing to do with it.


A possible solution is to put something (f.e. a minimal webserver) at www.websiteA.com that performs a HTTP redirect to http://xxx.xxx.xxx.xxx/pathA.

Massimo
  • 68,714
  • 56
  • 196
  • 319
2

TL;DR

No you can't.

The bigger picture

DNS only maps names to addresses using A records when it comes to IPv4 and AAAA records when you're dealing with IPv6.

I'm assuming that you have a web server that shall serve different documents for two distinct domains. If I'm right, then I suggest you look into the concept of virtual hosts/servers. As an example, here is the documentation for Apache httpd's virtual host configuration. The basic idea is, that you set up multiple A/AAAA entries with the same address, but different names in your DNS pointing to your web server. Web servers can - since the HTTP protocol carries that information - find out with which name a request was made with and decide what documents to serve accordingly.

Timor
  • 161
  • 10
  • Thanks for the response. – pedron Nov 12 '20 at 14:02
  • You're very welcome, I hope it helped. Please consider selecting one of the answers as your accepted answer as well if your question has been sufficiently answered. This way it doesn't get listed as open anymore. – Timor Nov 12 '20 at 18:17