Fix Homebrew permissions after El Capitan upgrade

I upgraded to El Capitan over the weekend and today hit an error about /usr/local not being writable. Running brew doctor said to run the following to fix the issue:

$ sudo chown -R $(whoami):admin /usr/local

After that, the error went away and everything worked perfectly.

Changing domains on a WordPress multisite installation

If you get a “Cannot establish a database connection” error while trying to move a WordPress multisite installation to a new domain, you have to update the domain column in wp_blogs to your new domain:

UPDATE wp_blogs SET domain = '<NEW DOMAIN>';

You also have to update the home, siteurl, and fileupload_url values in the wp_X_options tables.

I don’t know all that much about WordPress multisite, so maybe this method is hacky and should be avoided. But it worked for me with no downsides, so I went with it.

Redirecting www subdomain to bare domain

I normally like doing this in a <VirtualHost> block, but the client is on shared hosting and I only have access to .htaccess:

RewriteCond "%{HTTP_HOST}" "www.example.com"
RewriteRule ^ http://example.com%{REQUEST_URI} [R,L]