Reputation: 375
I want to create a blog site with only one CMS. This CMS will be in different domain.
For example: mycms.com
Then my blog sites are also in different domains.
For example: website1.com, website2.com, website3.com
They will all use mycms.com as their admin
*Images will be uploaded in mycms.com/images/ so all the 3 websites will get the images from this directory
If images are loaded on website1.com from the main database, they should be displayed as if they're from website1.com. So for example website1.com/images/cat.jpg instead of mycms.com/images/cat.jpg
How will I build this using codeigniter?
Upvotes: 1
Views: 1189
Reputation: 571
You can use the same CodeIgniter /System and /Application folders for all the websites if you like; just make sure all the index.php
files are setup to use those same folders for $system_path
and $application_folder
respectively. Note that these sites also need to reside on the same server.
You can serve up different content by checking $_SERVER['HTTP_HOST']
for the domain the request came from.
As for htaccess you should be able to use %{HTTP_HOST}/$1
or %{HTTP_HOST}$1
(depending on server config) to make the rewrite rule dynamic.
I am actually building a similar project right now using CodeIgniter but there are also several other projects available like halogy, codefight, pyro (with an extension), and many others.
Upvotes: 2
Reputation: 77966
CodeIgniter has a System and an Application folder. You could have one global system folder and then one application folder for each of your subdomains, or you could have one application folder and just make your subdomian folders parallel with your www folder.
Upvotes: 1