TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
4.27k stars 418 forks source link

Redirect page to a zone #671

Closed muhanadali100 closed 1 year ago

muhanadali100 commented 1 year ago

I have multisystem on the same linux system on same ip address like

1- 1.1.1.1/rad 2- 1.1.1.1/git

can i make a forward by dns to make this

1.1.1.1/rad --------> rad.ams.com 1.1.1.1/git ---------> git.ams.com

ShreyasZare commented 1 year ago

Thanks for the post. This is a very common question about redirecting a URL but, that is not possible with DNS. Redirection of URL happens at the HTTP protocol level. So, you need to configure your web server for handling that specific request and make it do a 302 redirect to the URL of your choice.

For example, if you are using nginx as the web server, use the config snippet shown below:

server {
    listen 80;
    listen [::]:80;
    server_name 1.1.1.1;

    location /rad {
        return 302 http://rad.ams.com$request_uri;
    }
    location /git {
        return 302 http://git.ams.com$request_uri;
    }
}