Search code examples
node.jsreactjsmern

How do I achieve this 2 web addresses for one website. i.e. www.administrator.sitename.com and www.sitename.com?


I want to create a website where I want a normal web address for site visitors i.e. www.sitename.com and the administrator of the website should have a web address like www.administrator.sitename.com. How do I achieve this? Just to clear things out, site visitors do not have the feature to create their own accounts on the website. There is only one user that exists i.e. Administrator.

Any other suggestions for implementing this system are also appreciated. This system will be implemented using the MERN stack so, please provide references accordingly.


Solution

  • This has nothing to do with MERN Stack. You basically need to do two things:

    1. Create a subdomain. This can be done by visiting your domain registrar (like goDaddy or any website from which you've purchased your domain).

    2. Host the admin panel on the subdomain.

    So, let's say you have purchased example.com from GoDaddy. Now, login to your account on GoDaddy and add a subdomain admin.example.com. Follow the guide on how to add a subdomain for your registrar.

    1. For GoDaddy, read this.
    2. For Namecheap, read this.

    That's it. Now you need to host two different websites (one for users and another for admins) one on main domain and another on a subdomain of your choice.