0

I'm running WordPress on a LEMP stack.

I have a landing page at: https://example.com/landing

I want to point this subdomain at the above page: http://landing.example.com

I don't want to 301/302 redirect the subdomain to the subdirectory.

I want visitors to think they are still on http://landing.example.com.

This question is similar but doesn't solve my particular problem.

I need to know how to rewrite the request with nginx and configure DNS.

Community
  • 1
  • 1
Ken Prince
  • 1,437
  • 1
  • 20
  • 26

2 Answers2

0

Link to previous post discussing rewrites/redirects/vhosts. You want to rewrite the request and then either land it on the same server or proxy it to a different one.

Community
  • 1
  • 1
Rick Buford
  • 629
  • 3
  • 4
0

I found the answer in this thread.

To summarize, you need to proxy the request with nginx:

    # abc.example.com
    server {
      listen 80;
      server_name .example.com;
      location / {
        proxy_pass http://127.0.0.1/abc$request_uri;
        proxy_set_header Host example.com;
      }
    }

The just setup an A record pointing at your server's IP.

Community
  • 1
  • 1
Ken Prince
  • 1,437
  • 1
  • 20
  • 26