define('DISALLOW_FILE_MODS', true);
Update: Feb 11, 2011 — If you’re interested in hosting multiple top-level domains, the new write-up is here.

In order for this to go smoothly, you should have a few things already taken care of.
A Record created in your DNS Zone. If you don’t want to fool with wildcards, use your control panel to create the subdomains in your hosting control panel (although you won’t be using the real subdomains).When you first visit your Manager, you’ll see the ‘web’ container in the nav area. This is the context that houses the default main site of your MODx installation.
The default ‘web’ context with basic pages added.
Our goal will be to create several of these “home folders” one for each subdomain that we will create. So, let’s go!
First we need to visit the ‘Contexts‘ menu, located at System > Contexts.
The Context area lists the default contexts: the ‘web’ context, which is the main site, and the ‘mgr’ context, which is the backend manager that we’re using to do this.
Click on ‘Create New‘ and we’ll create our first subdomain. The ‘Content Key‘ refers to how you want your context to appear in the sidebar and how you will refer to it when you tell MODx to go there. This should be simple and include no spaces (and preferably no caps). I typically name it the same as the submdomain I’m planning to use just because it makes things easier to remember (although these two names have no impact on one another). For this example, I entered the following:

If we refresh the resource list (using the green “recycle” arrows), we see our new context appear along with the original ‘web’ context. This will be the home of our first subdomain. Go ahead and create the minimal pages needed. I generally start with an index and an error page to get started. You can use the new ‘Quick Create’ feature by right-clicking the new context and choosing ‘Quick Create > Document‘. I typed the following:
As you can see, I typed something in the content area that will let me know that it’s successful when I go to test the subdomains later.
My resource list now looks like this:
To get this new context to actually behave like a website, we need to edit it and add a few necessary variables. So go back to your list of contexts (System > Contexts) and right-click the new context you created. From the pop-up menu, choose ‘Update Context‘. Once there, you should click on the green tab for ‘Context Settings‘.

Location of Context Settings Tab
Click on ‘Create New‘ and we’ll begin adding the variables that we will need, one at a time. When the ‘Create New‘ dialog pops up, the only settings you need to worry about are the Key, Name and Value. Everything else goes untouched. I add a description just for kicks, but the main site’s description will usually override this description anyway.

Do this once for each of the following settings:
site_start – the ID of your new context’s homepage.
base_url – Set this value to “/” (no quotes) since we’re making the root of the URL our base.
http_host – Set this value to “subdomain.yourdomain.com” (your subdomain url)
site_url – Set this value to “http://subdomain.yourdomain.com/” (FULL subdomain url). Must have trailing slash.
Note: You might recognize some of these variables, as they are simply overrides of options currently defined in the settings for the main site in your MODx installation. You can add any settings that you wish to customize for each site such as Default Template and Error Page.
Here are my finished settings.
So, let’s create a folder in our server to create a place where the subdomain’s files will live. We’ll place it in the same directory where modx is installed and give it the same name as our subdomain. My folder is called ‘subdomain1’ for this example.
Inside this newly-created folder, you will need to copy a few files from the MODx root directory:
.htaccess
index.php
config.core.php

Now, we edit these files so that they handle things properly when they’re accessed. Basically, we need to make them behave as if they were root folders.
Make sure that RewriteBase is set to “/” with no other folder names behind it. (In most cases, it will probably already be set correctly.)
Find
$modx->initialize('web');
Change to
$modx->initialize('subdomain1');
Change the context name to match whatever you named your context in the manager section.
Find
define('MODX_CORE_PATH', dirname(__FILE__) . '/core/');
Change to
define('MODX_CORE_PATH', '/home/example/public_html/core/');
Use the full web path to your site’s core folder. If you don’t know your site’s full path, check your control panel or hosting welcome letter. This information should be readily available with your account.
At this point, everything should be working smoothly and you can test the success of your setup by accessing http://www.yourdomain.com/subdomainfolder/ and you will see the contents of your main page.
In my case, I got the “This is Subdomain1” text that I typed as a success message. So, I’m in good shape!
Now that we have all of our settings in place and our folder created, we just need to tell the server where to redirect this traffic to so that we can be sure our visitors don’t see the main site when they access this url. In the official documentation, they describe how to do this in your Apache Config File. I got mine working that way, but it was a huge pain. I wanted to find a way that would work without needing to hack around in Apache. Not to mention, most users do not have root access to their config files.
After several days of searching, I came across a regex hack from jdmorgan at WebMasterWorld that could be placed in the htaccess file. The script will take any traffic that comes in through a subomain and redirect it to a subfolder that matches that subdomain. This turned out to be exactly what I needed since I wouldnt want my subdomains to have to share folders and files with the main site anyway. That would be a disaster waiting to happen.
Place the following script in the .htaccess file that resides in the MAIN folder of your MODx installation. This does NOT belong in the .htaccess files of your subsequent folders. Add this to your .htaccess AFTER the Friendly URLs code or it will break Friendly URLs
#REDIRECT SUBDOMAIN TO SUBDIRECTORY OF SAME NAME
RewriteCond %{ENV:REDIRECT_SUBDOMAIN} =""
RewriteCond %{HTTP_HOST} ([a-z0-9][-a-z0-9]+)\.yourdomain\.com\.?(:80)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.*) %1/$1 [E=SUBDOMAIN:%1,L]
RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]
If you had success above when accessing your subfolder directly, you will be equally rewarded when you visit http://subdomain.yourdomain.com, where you should see the contents of your subdomain’s home page.
Now that you have this working, you can repeat this process as many times as you wish to launch any number of subdomains within your MODx installation.
Our next task is that of hosting completely different domains inside a single MODx installation.
If you’re getting an Error 503 when you access either the subfolder or the subdomain, then you need to check your config.core.php file. If the path there is not specified correctly, you will get this error.
You might also check that the Context settings you created are correct.
To be sure our redirect script is working, try adding a simple HTML file into your subfolder and accessing it via the subdomain (without folder name in URL). If you get a 404 error, then your site does not have a subdomain or wildcard set up.
]]>
The other day, I finally broke down and bought a wireless aircard from Sprint. The problem is: I couldn’t get it working on OS X, even after calling tech support!
Yes, I have access to T-Mobile hotspots. Yes, there is a Starbuck’s on every corner. But sometimes I need access from random places. The moments when I find myself in a situation where Internet is not readily available are rare. But when I need to get online, and I’m on a meeting with a small business in the middle of nowhere, $60 per month is chump change considering that could mean the difference between my landing the account or heading back home passing the time with Facebook Word Challenge.
Although I’m not fond of their cellular plans, I decided to go with Sprint, since I’m confident that they’ll have the broadest coverage in the areas where I’ll likely be.
I chose the Sierra Wireless Compass 597 USB aircard. I didn’t want to worry about whether or not the computer I’m using has a wireless card slot. (Especially, since Apple still hasn’t decided to put one on the regular MacBooks.)
Installing the software for these devices is seemingly straight-forward. But, contrary to what the instruction booklet tells you, their software does NOT immediately work with OS X. This is something I discovered after trying it, and later calling tech support.
These instructions were written for OS X 10.5 (Leopard), but you should be able to figure out the configuration settings on previous OSes based on these.
When you insert the broadband card into the USB port on your mac, the TRU-install CD image will automatically appear on your desktop. It will also pop-up the folder on the image that contains the installer for Sprint’s connection manager, SmartView.
The software can also be downloaded at http://www.sprint.com/downloads. Here is the direct download link for this device

Double-click the file called ‘Install Sprint SmartView.mpkg‘ and proceed with the normal Mac installation process. This will require a restart.
After you’ve restarted your Mac, you’ll notice that there is a new shortcut on your desktop for the Sprint SmartView software that controls the Sierra 597 USB device.

Launch the Smartview software.

The program displays the status of your wireless card. In this example, it’s ‘Ready: Sprint Mobile Boradband’. If this is a brand new wireless aircard, you’ll need to activate it. You can activate using the steps outlined on Sprint’s support website, or you can let the SmartView software do it for you. Some have reported failures during the automatic activation process, but it was seamless for me.
Go to the Tools menu and select Activate Device.
You may want to disable Airport or disconnect from your local network. If you can’t connect without it, then go ahead and re-enable your local network.
Once you’ve installed and activated, the software (and support representatives) will have you thinking that all you have to do now is hit ‘Connect’. Lies. While this step is necessary, it’s only 50% of what you need to do.
When you hit connect, it will probably prompt you for your Mac’s admin password and then just sit there. Lame.
What you need to do is configure this new network device in your OS X system preferences.
Launch System Preferences and navigate to Network.

Your system will alert you that a new network has been found. Hit Apply.
Now, highlight your Sierra Wireless connection in the sidebar. You’ll need to enter a telephone number, account name and password to make this work. The phone number and password are not specific to your account. You’ll need to fill in the properties of this panel with the following:

Click the Advanced button near the bottom and, under the Modem tab, choose Sprint as your vendor.

The only model available is PCS Vision. So select that and OK it.
Check the box to ‘Show modem status in menu bar’ if you choose.
Hit Apply.
Now you can connect using the icon in your menu bar every time you need to use your wireless card.

You MUST leave the SmartView software installed on your computer in order to connect. Your system preferences alone won’t be enough. You can, however, remove the Sprint icons from the menu bar and the desktop without hurting anything.
Ian McKellar, of the Songbird project, has released a witty little app that will take the RSS feed of any blog, merge it with cat images from Flickr and display feed titles in the standard Cat Macro style.
As of this writing, Ian has LOL converters for WordPress.com, Live Journal, Twitter & Jaiku. I created a few LOL feeds, and here are a couple of images that I got:

A tweet from Kelsey on my Twitter timeline.

A headline from ‘The Onion’ daily feeds.
To use these tools, visit http://lol.ianloic.com and enter the appropriate link for whichever type of feed you want to view. The tool for blog feeds is currently at the bottom. Just enter a blog’s feed URL, and in moments, see what it would look like in LOL Feeds style.
So, there you go! I do my best to give you guys excuses to slack off.
]]>