Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Map DNS CNAME from subdomain to a path

Tags:

cname

Suppose I have a web app running on myhost.com with the paths myhost.com/foo and myhost.com/bar.

Is it possible to use DNS CNAME records to map foo.myhost.com to myhost.com/foo and bar.myhost.com to myhost.com/bar. So for example, the request to bar.myhost.com/baz will go to myhost.com/bar/baz?

like image 358
User314159 Avatar asked Dec 02 '25 13:12

User314159


1 Answers

This isn't possible with a CNAME, or generally with DNS level configurations, to my knowledge. You'll need a server to redirect or replace the URL location with your desired URL location.

This is possible with a CNAME: foo.myhost.com => bar.yourhost.net

But this is not: foo.myhost.com => bar.myhost.com/foo

like image 98
Shain Lafazan Avatar answered Dec 05 '25 03:12

Shain Lafazan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!