e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 213 forks source link

Enhancement: Support multiple static domains for increased performance #2827

Closed CaMer0n closed 6 years ago

CaMer0n commented 6 years ago

Usage:

Create several subdomains with cdn1, cdn2, cdn3 etc for your domain, making sure that each of them point to the public_html folder. ie. When entered into the browser, each domain should appear identical to each other.

eg. Add the following to your e107_config.php file: (replacing each domain with the ones you just created)

$domains = array('http://cdn1.test.com/', 'http://cdn2.test.com/', 'http://cdn3.test.com/e107v2/');
define('e_HTTP_STATIC', $domains);

Visit your main domain. If you check the source-code, you should find that your css, js and image files are loaded from each of these sub domains.

Serios commented 6 years ago

I tested this on PHP 5.6.29 and unfortunately it doesn't work with arrays, it throws "Constants may only evaluate to scalar values" error.

However if you define e_HTTP_STATIC like this: const e_HTTP_STATIC = ['http://cdn1.test.com/', 'http://cdn2.test.com/', 'http://cdn3.test.com/e107v2/'];

It's working properly