0

I have my domain in Godaddy and only one web application is hosted in AWS Server with ASP.NET MVC Framework.

Consider my scenario :

for ex: https://www.lakshmicaddy.com

  1. User xyz is registering as new user in my website, then they need to get url as xyz.lakshmicaddy.com

2.User abc is registering as new user in my website, then they need to get url as abc.lakshmicaddy.com

Here I want to create a subdomain through programming in MVC and want to make let them point to the same www.lakshmicaddy.com application through https://xyz.lakshmicaddy.com and abc.lakshmicaddy.com

Question:

1.How can we create godaddy subdomain through ASP.NET MVC?

2.How can I link the subdomain with AWS application?

2 Answers2

0

GoDaddy may have an API you can use to automatically create subdomains and update your domain's DNS records - however, this would be problematic, as DNS record updates can take some time to propagate (24 - 48 hours, depending on the host).

A better solution might be to update a .htaccess file that gives the illusion of a subdomain for each of your users.

For example - you might have your application create a folder called /users/user1 (url would be lakshmicaddy.com/users/user1). Your .htaccess file would map this file path to something like user1.lakshmicaddy.com

Your .htaccess file might look something like this:

RewriteEngine on

RewriteCond %{HTTP_HOST} subdomain.example.com$

# Your application would add new entries similar to below:
RewriteCond %{REQUEST_URI} !^/subdomains/user1
RewriteRule ^(.*)$ /users/user1/$1 [L]

Depending on how your application has been set up - you might consider saving the user's subdomain in a database table, along with their other credentials. However - this would be entirely optional.

More information can be found here:

.htaccess rewrite subdomain to directory

.htaccess - Redirect subdomain to folder

Fake Subdomain with mod-rewrite

Community
  • 1
  • 1
Alex Mulchinock
  • 2,119
  • 1
  • 18
  • 25
0

I got a solution atlast.

I have created wildcard redirection like *.lakshmicaddy.com in binding and as well as A Name records in DNS Settings.

Then It is solved.