• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple sites, 1 codebase, not using symlinks

#1
[eluser]skattabrain[/eluser]
I was just reading this - http://ellislab.com/forums/viewthread/56436/ - and I'm wondering if there are any "gotchas" i need to consider for my solution. because the solution for my needs is so easy, works, and is so simple ... it's got to be wrong! lol

i have an account on the rackspace cloud (formerly mosso) and i have the need to host several blog/cms style sites for my clients ... but i want all these sites to load the same CI install and app folder. so we are talking ... carbon copies with their data stored in a database and unique templates are loaded based on the client ID.

my cms allows different templates for different user's pages, this all works already. if you need more info about this let me know. sites will have the same structure.

so basically, i create one master CI install ... it houses everything. i set the base_url like this ...
Code:
$config['base_url']    = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://').$_SERVER['HTTP_HOST']."/";

we will call this install ... MASTER.

--

now, each new CLIENT site, which i'll call client_01, client_02 etc ... (all hosted on the same cloud account) has this for their index files ...
Code:
<?php

    include('/mnt/mystore/xxxxxxxx/www.master.com/web/content/index.php');

?>

and their .htaccess files ...

Code:
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

so when i pull up www.client_01.com ... it produces the page as if I got it from www.master.com but the base_url is rendered as www.client_01.com. this works perfectly ... like scary well!

the .htaccess on the client ensures everything routes ... etc ... it all works, posting to forms works fine etc.

so i'm thinking ... i just fetch the proper items in each controller from a table based on the base_url ... and i can make the appropriate queries once i get an ID based on the base_url.

so before i get busy ... does this sound viable? any security risks? will something stop me cold 50% into this?

anyways ... here's to CI! it rocks!

oh ... and 1 more question ... will hosting assets like CSS, JS and Images be problematic if I link them to the master domain instead of copying them over? I rather not copy ... and I rather not use .htaccess trickery ... as it would seem to me that it would cause some CPU load to run every call against htaccess.

#2
[eluser]tomcode[/eluser]
If You want to use Flash assets (video) You either need to copy them to the client domain or You need to specify a cross-domain policy file.

Don't know if You need to do the same for some AJAX loaded content.

#3
[eluser]skattabrain[/eluser]
ajax seems fine as it's working perfectly... but to be frank, i need crash course in cross site scripting.

Code:
$config['global_xss_filtering'] = TRUE;

i also use xss_clean in all validation rules.

#4
[eluser]tomcode[/eluser]
[quote author="skattabrain" date="1250032905"]... i need crash course in cross site scripting.[/quote]

Same with me.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.