I am developing an application using Spring , jsp and Apache 7.0 server, now suppose i have register domain such as "www.example.com" and in my application the user fills the registration form in which the user is ask to enter his url to name such "123" as soon he submit the form after filling details i want to redirect the him to the newly created URL now in our case "123.example.com"
Now at this movement i have to create sub domain in my code itself before he gets redirected. I have gone through google not find much.
Any help
Thanks in advance.
You need to enable wildcard subdomains. That will allow your app to respond to requests from anything.yourdomain.com. Next, your app needs to define a route which converts the subdomain to a variable so that you can use it to scope your database requests to their account. Once the user has their custom subdomain set up, they should register their domain under their account (so that you can look up the account by domain instead of subdomain) then create a CNAME DNS record which points to their subdomain. These principles apply regardless of the language/framework.
You could use a wildcard cname (i.e *.example.com) then use a spring interceptor (https://dzone.com/articles/using-spring-interceptors-your) to determine which subdomain the user requested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With