Centralizing Resources Across Multiple Joomla Websites

Centralizing Resources Across Multiple Joomla Websites

Efficiently managing multiple websites can be a complex challenge, particularly when deadlines are tight and visual consistency is required. Such was the case when we were tasked in 2016 to develop several visually similar websites under a strict corporate style guide. While the initial project seemed straightforward, the scope quickly expanded, prompting us to develop a more scalable approach. Here’s how we centralized code and resources across multiple Joomla websites to enhance efficiency, ensure scalability, and streamline long-term maintenance.

Understanding the Problem

Initially, our client needed us to implement 3–4 sites based on a shared template. While visually similar, each site had slight variations. It wasn’t until after delivering the first batch of websites that our client revealed their intention to launch 15+ additional sites with similar design and functionality over the following year.

This posed significant logistical challenges. Manually duplicating Joomla instances for each new site was inefficient and would make long-term updates across multiple sites cumbersome. A scalable solution was essential to ensure both flexibility and productivity.

Exploring the Possible Approaches

Option 1: A Single Multi-Domain CMS Installation

At first, we considered using a single Joomla installation for multiple domains. While technically feasible, this approach presented numerous drawbacks:

  • Each site would cater to a different department or project, resulting in minimal overlaps in backend or frontend user permissions.
  • Separate functionality requirements (e.g., specific components like Acymailing and DOCman) would increase complexity.
  • Unavoidable structural differences between sites would complicate maintenance.
  • Small exceptions or customizations could cascade into extensive workarounds over time, making the system fragile.

Option 2: Separate CMS Instances with Centralized Resources

Given the limitations of a multi-domain CMS, we instead opted for separate Joomla instances combined with centralized resource management. This enabled each site to remain independent yet benefit from shared code and resources, striking a balance between flexibility and efficiency.

Centralization in Action

We outlined three distinct phases for effective implementation:

  • Build the technical infrastructure to support centralization.
  • Retrofit existing sites to comply with centralized standards.
  • Develop processes for seamlessly integrating future websites.

These steps enabled us to implement a robust system without disrupting live environments.

Implementation Phase

Centralizing CSS and JS

Before centralizing these resources, each site held independently managed CSS and JS files. Over time, this resulted in variations across sites due to different developers working under tight deadlines.

To address this, we:

  • Analyzed and harmonized CSS/JS files from the existing websites, removing redundant code and isolating site-specific elements.
  • Created shared “global” files for all universal code and “local” files for site-specific customizations.
  • Updated the template index.php file in each Joomla instance to load centralized resources stored on a dedicated subdomain (e.g., data.domain.com/templates/name/css/).

This reduced the number of CSS/JS files from dozens per site to two files per shared domain.

Final File Structure:

Global CSS/JS:
  • CSS: data.domain.com/templates/name/css/custom.css
  • JS: data.domain.com/templates/name/js/custom.js
Site-Specific Overrides:
  • CSS (e.g., for site1): data.domain.com/templates/name/css/local/site1.css
  • JS (e.g., for site1): data.domain.com/templates/name/js/local/site1.js

Centralizing PHP Files

For scalability, we centralized most PHP files (e.g., index.php, error.php, etc.) from the main Joomla template. To ensure flexibility, we implemented conditional checks within the template files:

  • If a local override existed, the system would prioritize the custom file.
  • If not, the shared global file was loaded.

We also centralized SP Page Builder layout overrides and created reusable custom addons to further streamline development.

Other Centralized Resources

  • Language Strings: Using a custom Joomla plugin, we centralized all language strings into a single shared XML file.
  • Document Management: DOCman was configured to serve files from a centralized repository.
  • Shortcodes: ReReplacer rules were consolidated into one XML file, reducing redundancy and simplifying management.
  • Corporate Icons: A central font-face icon file was created to ensure uniform iconography across all sites.

Risks and Lessons Learned

Centralization brought numerous benefits, but it also presented a few challenges:

  • Single Point of Failure: Centralization made all sites reliant on shared files. Any bug in these files (e.g., a misconfigured error.php file) could disrupt multiple sites simultaneously.
  • Documentation Needs: Documenting every new feature and modification became crucial to ensure consistency and avoid misunderstandings during future updates.
  • Collaboration: Shared resources required careful coordination among developers to avoid overlap or unintended conflicts.

Final Results and Takeaways

By centralizing resources across multiple Joomla websites, we achieved:

  • Faster updates and improvements across all sites.
  • Simplified onboarding of new sites into the system.
  • A responsive, scalable solution that met the client’s growing demands.

This experience reinforced the importance of balancing flexibility with efficiency when designing centralized systems. It also demonstrated Joomla’s capability to scale effectively for complex, multi-site projects.

If you're considering a website upgrade or migration—whether to Joomla 4/5 or another CMS—our team is ready to guide you through the process. Contact us today for a free consultation and learn how we can optimize your digital environment!