Jeremy Simkins | Web Developer

Aug
31

Use one SweetCron install for multiple domains

Filed Under: SweetCron

Well,

After playing with sweetcron for a bit I wanted to have 4 sites use it but I didn’t want to have to update each site everytime I need to update sweetcron. I found a little tweak you can do to get sweetcron working on multple domains with one install.

First, create the folder and put the files in there from the sweetcron download.

Next, point a domain to that folder ( i am assuming you already know how to create domains and already know how to point your domains to a folder on your server)

Next, point the second domain to that same folder. (at this point you will notice both domains are identical and use the same sweetcron.)

Now we are ready to get each site using its own sweetcron.

First, open /system/applications/config/config.php
you will want to change
$config['base_url'] = “http://www.your-site.com/”;”
to
“$url = $_SERVER['SERVER_NAME'];
$config['base_url'] = ‘http://’.$url.’/';”

config.php screenshot

config.php

This will keep the scope correct for which domain you com in from.

Second, open /system/applications/config/database.php
now since we are using multiple domains we will want to create a switch so we can pull the correct data for each domain. I could not get the database prefix to work for me on this setup and I didn’t bother to look into it since I just used different databases for each site. So I created a switch off of the given domain and set the appropriate database to use.

database.php screenshot

database.php

Now you are able to have multiple sites point to one install of sweetcron.

** NOTE **
I had one issue with install on this. I could not get the database prefix to work correctly with sweetcron. I’m not sure why but i didn’t spend anytime looking into it either. It was just as easy for me to use different databases for each domain. In theory you could do the same switch on the database prefix instead of the database name.

One Response to “Use one SweetCron install for multiple domains”

  1. SweetCron Reviews and Resources Roundup | Lifestream BlogOctober 6th, 2012 at 4:19 pm

    [...] Using one install for multiple domains [...]

Leave a Reply

Profile

Jeremy Simkins is an accomplished senior web developer with over ten years in the production field. Experienced PHP developer as well as a passionate software engineer. Jeremy specializes in code optimization, performance, and implementation.

View Jeremy Simkins's profile on LinkedIn

Open Source Projects

MPS Mod

FriendFeed

WordPress

Copyright ©2009 Jeremy Simkins