For anybody using a Hetzner VPS running Plesk 11 who needs to install WordPress Multisite in wildcard subdomain mode – this post is for you 🙂 (and indeed me, when I come to do it again and can’t remember how I got it working in the first instance).
There is quite a well written and extensive post in the Codex about getting the wordpress multisite setup;
First of all you need your DNS setup on the main domain being used for the install. I’ll be honest here, I’ve never quite got my head around the Hetzner robot and it’s relationship with the DNS records set in Plesk so I tend to go for a belt and braces approach to things and do both. I use a custom zone file for my robot DNS, so I add in;
*.example.co.uk IN CNAME example.co.uk
into the DNS settings in Main Functions -> DNS. Then I would apply the same settings to the domain itself in Plesk (Domains-> Websites & Domains->DNS Settings) and apply the updated DNS changes to the template.
Now the bit that seems to get a bit messy – having looked at the Codex article as well as various forum threads and blog posts on it, it would seem that (as always with Plesk) there are differences depending on both the version you are using. Then you’ve got the variances in the server config to deal with and it’s hard to say with any confidence exactly what you are supposed to do. If you pay a lot for your hosting and get great support, ask your hosts (the last time I did this Ewan at Nublue sorted it out for me, but that was years ago on PLesk 8) – no danger of that at Hetzner on an unmanaged Hetzner v19 (although they are much more helpful than most and at least all experts rather than call centre script drones).
I created a vhosts.conf file in /var/www/vhosts/example.co.uk/conf (there wasn’t one already) and added the following to it;
ServerName "example.co.uk" ServerAlias "*.example.co.uk"
And then….the key. Easily missed, halfway down the Codex article;
You need to use that command to rebuild the hosts config. God only knows how the Codex author found that command in the thread he quotes, I suspect this issue may have cost a lot of people a lot of time. Note that I was able to remove the content of the vhosts.conf file and rerun the command above and toggle on/off the subdomain functionality without having to reboot Apache.
Anyway, after that your subdomain install will work perfectly – with one caveat. Any subdomains you previously had running under the normal Plesk setup will obviously be problematic, although now I think that maybe my problem relates to using the NOBLOGREDIRECT parameter in wp-config.php, as seen below (you may find those settings useful too);
/* Multisite */ define( 'NOBLOGREDIRECT', 'http://www.example.co.uk' ); define('WP_ALLOW_MULTISITE', true); define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); $base = '/'; define('DOMAIN_CURRENT_SITE', 'www.example.co.uk'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); define("GF_LICENSE_KEY", "xxx"); // Note, add you Gravity forms licence here to network enable the plugin in all sites
Hope this helps.