The intent of this post is not to cover standard domain mapping for networked WordPress blogs; instead, this post describes how to set-up second-level domain mapping for WordPress network blogs when WordPress is not the CMS for your primary domain.
In other words, let’s say you have a site
example.net which is your company’s primary site. This is your company’s public facing website, and you have set up a CNAME for it at
www.example.net and both of them are run off the same Apache 2.x name-based virtual host. You also have a site
intranet.example.net which is the corporate portal your company’s employees use for web-mail, file hosting, and human resources data. This is just another CNAME that resolves to the same IP address as the company’s public facing website; another Apache 2.x name-based virtual host processes the incoming domain-name, and, in this case, it actually acts as a proxy to an internal IIS server which hosts the portal software.
So, Apache is handling all of your incoming web traffic and re-routing it appropriately. Now, one of the department managers (we’ll call him Fred) decides he wants his employees to be able to set-up their own blogs. You install WordPress 3.x and create a network. The WordPress installation is just another Apache name-based virtual host mapped to
blogs.example.net. All of Fred’s employees now have blogs with addresses like
blogs.example.net/fred. Fred isn’t happy about this, though, because he wanted his blog to be
fred.example.net, and he sends what he thinks is an angry e-mail to your boss saying so much. Your boss thinks Fred is crazy, but because Fred’s mother is the CEO who put him in that job so she didn’t have to listen to him whine about not having a job, your boss asks if you can do anything about it.
You have a couple options:
- Create a new virtual-host with a fresh WordPress install for every blog
- Use the WordPress MU Domain Mapping plugin to solve your problem
When you install the WordPress MU Domain Mapping plugin, though, you realize that it requires Apache to be routing the new domain into the original name-based virtual host. Since you already have another system accepting wild-card domains for the server, how do you go about this? Answer: ServerAlias.
- Make sure that the WordPress MU Domain Mapping plugin is installed properly using CNAME matching by following the great documentation that comes with it.
- Add a CNAME for every blog pointing to the base domain name of the WordPress network (e.g.,
- In your VirtualHost file, add a ServerAlias directive for every alternate domain name you will be supporting, as in the following example
When attempting to use
has_and_belongs_to_many you might run into a “relation does not exist” error. If you created a join table migration already, and you’re wondering why ActiveRecord isn’t looking at it, you probably used the wrong table name.
Creating Join Relations Correctly
When looking up a
habtm join table, ActiveRecord arranges the model names in alphabetical order. So a
habtm join table for the models
People should have a table name of
clubs_people. The migration should look like this:
Just as a reference for the future, you should also notice a few more things about this:
:id => false
When I create a join table, I don’t need an extra ID field hanging around. I will never be looking up a join by its id, so including an ID is wasteful. This does create a small problem, however: ActiveRecord will not create a default Primary Key, so you will have to create it yourself.
Instead of using
t.integer, I use
t.referencesbecause it will automatically link to the default Primary Key on the table names it is given in symbol form.
add_index...:unique => true
I add an index between the two fields for faster recall from the database. I make the index unique because a record in Table A should not be associated with a record in Table B more than once in a join table in most circumstances.
Fixing Already Migrated Relations
The above doesn’t help if you’ve already created your table, but the solution is very simple:
I have been really intent on making real hot chocolate for a while now. I cannot stand the powdered stuff that gets passed off as a suitable replacement, so I took to the Internet and was lucky to get a hit on the first site I tried. (I would have been amazed if Cook’s Illustrated didn’t have a recipe for it!) True hot chocolate ends up being about as easy to make as its powdered counterpart, it just takes a little bit longer and you have to have the ingredients on hand. The key is balancing the amount of dairy with the amount of chocolate, and you have to use good chocolate to get a good result. Sugar and vanilla are added to enhance the taste, but the amounts are negligible considering how much dairy and chocolate you have. I just have to say that the real stuff is absolutely amazing, and you will never want the powdered stuff again.
What made the hot chocolate even better, though, was drinking it with hot cinnamon buns. Now, in the case of cinnamon buns I will sometimes just use the canned variation from the freezer, but I find that it produces inconsistent results, usually with a lot of burning on the bottom. Instead, I flipped to a recipe I’ve relied on for a while in King Arthur Flour’s Baker’s Companion. Unlike other cinnamon bun recipes which rely on a quick bread method (e.g., leavening with baking powder, baking soda, or both), this recipe relies on yeast, giving it a distinct flavor in the dough itself and an airier texture. Unfortunately, the filling designed by KAF leaves something to be desired, as it does not give the impact that one normally expects from a cinnamon bun. I intend to experiment adding ground clove and ground nutmeg into the mixture in the future to give the taste the radiating warmth that one should feel when biting into a cinnamon bun.
I have started learning Scala as part of an independent study project targeting the functional programming paradigm and, to some degree, resource-to-user scheduling algorithms and their NP-complete properties. Now, my background in computer programming languages so far includes Python, PHP, Bash, Ruby and Java. Scala’s syntax is a major departure from what I am used to, primarily because of its focus on the functional paradigm.
This is a personal thing in the UX domain, but I think it applies to more than just me. I see too many sites where the first set of words in the title of each web page on the site is the name of the site itself followed by the actual page title. For me this doesn’t make sense, for two reasons.
I know a lot of people who keep thinking that implementing a new productivity system will change their lives around immediately. I fall prey to this kind of thinking a lot of the time, too. I’m an avid GTDer who believes in the system, but I sometimes get into so much GTD (putting what I have to do into my system), that I never actually get things done. GTD, the system designed by David Allen and propagated through his books and his company, David Allen Company, emphasizes getting what your “commitments” are into a trusted system that is organized by “context,” or the environment you have to be in to complete those commitments. Once they’ve been organized, you can complete your commitments by referencing the context you are currently in and then completing the commitments currently available to you.
I’ve been playing around with the newest Drupal beta. Drupal 7 looks like it’s going to be much more user friendly, which is wonderful! I stopped using Drupal as a CMS because I felt like I spent more time configuring the system than I did generating content. Which, for a content management system, seems a bit ridiculous.
That being said, Drupal is also much better tailored out-of-the-box as a multi-user CMS versus WordPress which is much better out-of-the-box as a single-user blogging platform. I don’t intend to switch my installation of WordPress 3 to Drupal 7 at any point in the future, mostly because of the prevalence of WordPress templates. However, I hope to use Drupal 7 to power future web projects that don’t require a from-scratch approach.
When did you last use water? Washing your hands? Doing the laundry? Eating? Think about that water! Was it clear? Was it safe? Was it easy to get to?
And, last but certainly not least, do these questions sound ridiculous?
My GTD workflow is for the most part a connected system of OmniOutliner documents managed by DEVONThink with the actual task-work managed in OmniFocus. Other than that, I use a metal inbox next to my desk as a primary collection bucket and a raised file-rack for project support and tickler files. I also have a whiteboard next to my bed for midnight thought streams, and I use my iPhone for on-the-go collection.
I’m currently using DreamTemplate’s Color Paper Theme, but I noticed that the code for the index.php file messes up the rendering of the index page. To fix, you need to change lines 7 and 31 from
<?php the_content(''); ?>
<?php the_excerpt(); ?>
Now, the template will render an excerpt instead of the actual post on the main page. That will prevent the featured post from extending over the boundary as well as truncate the rest. If you just want to truncate the featured post, change only line 7.