I have an application developed in dot net core 5.0 with the domain india.com Now I have to bind dynamic subdomain to domain india.com. Example: br.india.com, sa.india.com, rs.india.com, ax.india.com, ....
and so on.
Challenging work is that I want all subdomain binding dynamic it won't be static. that will be handled from the database.
Anyone could please help me. Thank you in advance.
Base of your Webserver (IIS, Nginx,...) is diffrence:
IIS: web.config need add rewrite role:
Redirecting a domain to a subdirectory
<rule name="CustomRule" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*.mydomain.com" />
<action type="Rewrite" url="http://example.com/{R:0}" />
</rule>
Nginx:
server {
listen 80;
server_name *.example.com;
return 301 https://$host$request_uri;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.