Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

How to make nginx to redirect multiple subdomains?

$
0
0
How to make nginx to redirect multiple subdomains? Including non-www redirects to the domain with www.
For example, my website is abc.com, under the site has several directories aaa, bbb, ccc, ddd, DNS has been set up correctly, all point to the same IP. How to meet the following requirements:
Enter abc.com automatically redirected to www.abc.com
Enter aaa (or bbb, ccc, ddd) automatically redirected to the corresponding web directory, such as aaa. abc.com then displays the contents of the web root directory /aaa, while the address bar unchanged?
If you enter aaa.abc.com/aaa or www.abc.com/aaa returns 404 (as it has been redirected to the aaa directory, but no aaa aaa following directory, so returned 404)

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>