Domain Redirection

Started by qx_1789, Jan 23, 2023, 05:43 AM

Previous topic - Next topic

qx_1789Topic starter

Good day,
such a situation: 12+ domains are registered on one DNS. How do I redirect to a specific page of the main domain?


DNS itself does not allow redirecting to individual pages of Web servers (as I understand it, we are talking about the Web here). The fact is that although DNS is used for address translation, including HTTP servers, it does not know anything about HTTP. And it is clearer than the page is the concept of a Web server.
What can you do to solve your problem?

You can create an HTTP server to point all your addresses to. Configure it so that all these DNS names will lead to a specific page of the server you are looking for: redirect to it or just work in proxy mode.
nginx, apache or another universal web server can solve this problem.

Here is an example of configuring nginx running in proxy mode:

server {
  listen 80;

  location / {
    proxy_pass    ;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_connect_timeout  150;
    proxy_send_timeout      100;
    proxy_read_timeout      100;
    proxy_buffers          4 32k;
    client_max_body_size    8m;
    client_body_buffer_size 128k;


In this case, when accessing the server the content of the page will be displayed /, but note that there will be no client redirection, the server will read the page itself and give it back.
Redirection, of course, can also be configured. This is also done by means of a web server, in this case nginx.


You mean redirecting to a web page. And to implement this mechanism, an HTTP server will be required that processes the HTTP client request and redirects it. Moreover, this redirection can be made using different techniques.
And by means of DNS, you can give the client a different hostname or FQDN through a CNAME record, but this is not a web page.