Here are three main ways you can map different domains to subfolders:
🔹 1️⃣ Method: Domain Mapping to Subfolders (Using .htaccess or Nginx)
If you want example1.com to show maindomain.com/folder1 and example2.com to show maindomain.com/folder2, you can use .htaccess (for Apache servers) or Nginx rules.
🛠 How to Set It Up (Apache / .htaccess Method)
- Open your
.htaccessfile (located in thepublic_htmlfolder). - Add this rule at the top:
RewriteEngine On # Redirect example1.com to maindomain.com/folder1 RewriteCond %{HTTP_HOST} ^example1\.com$ [NC] RewriteRule ^(.*)$ /folder1/$1 [L] # Redirect example2.com to maindomain.com/folder2 RewriteCond %{HTTP_HOST} ^example2\.com$ [NC] RewriteRule ^(.*)$ /folder2/$1 [L] - Save the file and clear your cache.
📌 Example:
- Visiting
example1.comwill showmaindomain.com/folder1but keepexample1.comin the URL bar. - Visiting
example2.comwill showmaindomain.com/folder2but keepexample2.comin the URL bar.
✅ Best for: Multi-business sites, landing pages, or brand-specific pages.
🔹 2️⃣ Method: Addon Domains with Subfolder Document Root
Many cPanel-based hosts allow you to map a domain directly to a subfolder.
🛠 How to Set It Up in cPanel
- Log in to cPanel.
- Go to Domains → Addon Domains.
- Add a new domain (
example1.com). - Set the document root to
/public_html/folder1. - Repeat for additional domains (
example2.com → /public_html/folder2).
📌 Example:
example1.comloads content frommaindomain.com/folder1.example2.comloads content frommaindomain.com/folder2.
✅ Best for: Hosting multiple separate sites under one hosting account.
🔹 3️⃣ Method: WordPress Multisite (For WordPress Websites)
If you’re using WordPress, you can use Multisite + Domain Mapping to map different domains to different subfolder-based subsites.
🛠 How to Set It Up
- Enable Multisite in
wp-config.php:define('WP_ALLOW_MULTISITE', true); - Set up Multisite (Subfolder Mode) in WordPress.
- Install a domain mapping plugin like:
- Add new sites (e.g.,
maindomain.com/folder1andmaindomain.com/folder2). - Map
example1.com→maindomain.com/folder1. - Map
example2.com→maindomain.com/folder2.
📌 Example:
example1.comshows content frommaindomain.com/folder1but keepsexample1.comin the URL.example2.comshows content frommaindomain.com/folder2.
✅ Best for: Running multiple sites from one WordPress installation.
🔹 Which Method Should You Use?
| Scenario | Best Method |
|---|---|
| Show different subfolders under unique domains | .htaccess redirects |
| Map different domains to subfolders (static sites) | cPanel Addon Domains |
| WordPress sites needing domain mapping | WordPress Multisite |
💡 Need Help?
Let me know which setup you’re using, and I can guide you step by step! 🚀😃

