External Publication
Visit Post

How to map different subdomains to the same directory?

InfinityFree Forum [Unofficial] May 3, 2026
Source

I want to configure multiple subdomains to point to the same directory (document root), but I do not have access to the server configuration (Apache/Nginx). I am using a hosting provider with limited access (shared hosting).

Goal

I have:

  • a.example.com
  • b.example.com

And I want both to serve content from the same folder, for example:

public_html/myapp

Current situation

  • Both subdomains are already created in the hosting panel
  • By default, each subdomain points to its own folder

What I want

Instead of separate folders, I want:

  • a.example.com โ†’ public_html/myapp
  • b.example.com โ†’ public_html/myapp

Constraints

  • I cannot edit Apache/Nginx config (no access to virtual hosts)
  • I only have access to:
    • Control panel (e.g., vPanel)
    • File manager / FTP
    • .htaccess

Question

What is the best way to make multiple subdomains point to the same directory in this situation?

  • Is there a way to configure this via the hosting control panel?
  • Can this be achieved using .htaccess (rewrite or redirect)?
  • Or is there another workaround (e.g., symlinks, addon domains, etc.)?

Discussion in the ATmosphere

Loading comments...