Creating Subdomains Programmatically

前端 未结 3 959
你的背包
你的背包 2021-02-02 02:05

I am looking for a solution to create subdomains programmatically in ASP.NET, ASP.NET MVC and PHP. Specifically, a user profile page should resolve for both: www.domain.co

3条回答
  •  醉酒成梦
    2021-02-02 02:21

    Update your DNS settings of the particular domain so that *.domain.com all point to the same host.

    Then, programmatically check and see if the first part of the URL used contains the subdomain you are looking for, and act accordingly. For example, if the first part contains a given profilename, then retrieve that particular profiles collection of data from your DB and display it to the user.

    Make sure your web application uses relative links, so that if the user arrives at the site using a subdomain, that you don't redirect them elsewhere.

提交回复
热议问题