• Hello and welcome! Register to enjoy full access and benefits:

    • Advertise in the Marketplace section for free.
    • Get more visibility with a signature link.
    • Company/website listings.
    • Ask & answer queries.
    • Much more...

    Register here or log in if you're already a member.

  • 🎉 WHV has crossed 10,000 monthly views and 50,000 clicks per month, as per Google Analytics! Thank you for your support! 🎉

How to Organize Files and Databases for Multiple Domains on Shared Hosting

johny899

New Member
Content Writer
Messages
245
Reaction score
3
Points
23
Balance
$230.0USD
Having more than one domain on a shared hosting account is great, until files get all scattered and you can't even tell which files are for which domain name. I have experienced this situation before, and let me tell you, there is not a worse feeling than looking to find a pair of shoes in your messy room, one shoe in the corner, the other shoe under the bed. The good news? If you organize everything properly, you can keep any chaos contained!

Separate Folders for Domains​

Each domain is like a separate house. Each house needs rooms, no one needs shared drawers! The main domain of your shared hosting account is in public_html, and addon domains should each have their own folders within that folder.

Example:

• public_html/domainA.com/

• public_html/domainB.com/

This method allows you to edit something on domain B without accidentally interfering with domain A.

One Database for Each Site​

Have you tried sharing one journal with three people? Chaotic, right? It is the same way for databases. One domain, one database, move along!

What you can do:

  • When you add a domain, create a new database.
  • Name things clearly ( db_mysiteA for example).
  • Make sure to ALWAYS have different usernames and passwords. If one is hacked or corrupted, at least the rest are safe.
Plain Naming

Here's a tip to save you hours later on: plain names. Don't use "test1" for your folder or "db123" for your database - you'll forget. Use the domain you're actually going to point to.

For example:

  • Folder → myblog.com
  • Database → db_myblog
  • User → user_myblog
Plain naming = Less worrying.

Take Backups Regularly​

Things can go wrong. Perhaps some update breaks your site, or a plugin decides to malfunction, or you accidentally delete the wrong file at 12:00AM (been there). That is where backups come into play.

I suggest you do the following:

  • Back up your site once a week, on autopilot.
  • Have a copy somewhere in the cloud or on your computer.
  • Occasionally test the backups just to make sure the restore works.

In Summary​

It does not have to be difficult to manage many domains on a shared host. If you

  • Keep each domain in its own separate folder,
  • Use a different database for each domain,
  • Implement a sensible naming convention, and
  • Make backs regularly, you will save yourself a lot of headaches.
Think about it, you are running a library, each book is on a shelf, it has a name on it, and you have one (or two or four) backups. Use your hosting in a similar structure, and your sites will be orderly, fast, and easy to manage!
 
Top