Generate redirects.conf

redirects.conf is fairly hard to maintain, mostly because of its
irregular syntax. Also, mistakes in regexes, such as unescaped dots in
domain names, are very common. So, generate it from a DSL instead. It's
like an oyster knife as mod_rewrite is to a Swiss Army knife.

The format is vaguely inspired by wikiversions.dat. It's simple and
restricted enough that it should be possible to migrate the
implementation away from Apache if we want to do that -- it could
generate a CDB file for PHP, or a configuration file for some other
webserver.

The parser does a check for double redirects using the naïve O(N^2)
algorithm, and raises a fatal error if it finds any. This prevents
infinite redirect loops and accidental listing of main wiki domains.

Also:
* Do protocol-relative redirects, fixing bug 31369 (enabled by
  I3adffd88)
* Encode non-ASCII characters, it's not technically correct to send a
  UTF-8 IRI in a Location header
* Remove wikipedia.org from redirects.conf, since there was a duplicate
  VirtualHost in wwwportals.conf. Moved the relevant RewriteRule to
  there.
* Added wildcard for wikipedia.com.il and wikipedia.org.il.
* Added rules for domains which were previously in the ServerAlias but
  with no corresponding RewriteCond.

Bug: 31369
Change-Id: I5b94a6bbecc271514e6874333d8d8dda07b8b3c6