Subdomain setup with subdirectories as alias

My site - https://qubitbd.com
I want, apis.qubitbd.com to serve from the apis folder of the root, that subdomain is already an API endpoint, people can give GET, and POST requests with parameters. I don’t want to redirect, I want to add a subdomain and serve from that folder like cpanel. how to do it.
I tried to add CNAME and point to root_site/apis, root_site. nothing works.

You can start by Creating a CNAME record in your DNS settings that points apis.qubitbd.com to qubitbd.com. This will map the subdomain to your main domain.

In your web server configuration (e.g., Apache or Nginx), add a virtual host block for the apis.qubitbd.com subdomain. This block should specify the document root as the apis folder within your main site’s root directory.

For example, in an Apache configuration:

<VirtualHost *:80>
    ServerName apis.qubitbd.com
    DocumentRoot /path/to/your/site/root/apis
    # Other configuration directives
</VirtualHost>

Ensure that the web server user has read access to the apis folder and its contents.

If the subdomain still doesn’t work after making the changes, clear your browser cache and wait for the DNS changes to propagate fully (can take up to 24-48 hours).

I hope this explains it all.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.