Package: wordpress Version: 4.5.3+dfsg-1 Severity: wishlist Dear Maintainer,
Please accpet my contribution to the wordpress package. It allows users to select a wordpress specific configuration from the web server config file. The issue with the current wordpress configuration lookup is that it uses only the host name to perform lookup. This does not allow you to host multiple separate wordpress sites on the same domain/hostname. My solution adds a few lines to the config and enables users to select the wordpress config they wish to use by setting a CGI variable called 'WORDPRESS_CONFIG'. The solution should work with every web server that implements CGI specification [1]. I have included sample apache config option and wp-config.php updates. In apache vhost configuration you can set the configuration you wish to use with somethink like: ```` SetEnvIf Request_URI "^/blog/(.*)$" WORDPRESS_CONFIG=blog ```` ```` /* Look up a host-specific config file in * /etc/wordpress/config-<host>.php or /etc/wordpress/config-<domain>.php */ $debian_server = preg_replace('/:.*/', "", $_SERVER['HTTP_HOST']); $debian_server = preg_replace("/[^a-zA-Z0-9.\-]/", "", $debian_server); if (isset($_SERVER['WORDPRESS_CONFIG'])) { $debian_file = '/etc/wordpress/config-'.$_SERVER['WORDPRESS_CONFIG'] .'.php'; } else { $debian_file = '/etc/wordpress/config-'.strtolower($debian_server).'.php'; } ```` The above code will select configuration '/etc/wordpress/config-blog.php' if the request path starts with "/blog/". I believe the patch greatly enhances the flexibility of the package with just a few lines of code. It enables users to host multiple wordpress instances in the same virtual host configuration like: - example.com - example.com/blog - example.com/other-wp-site etc. [1] https://tools.ietf.org/html/rfc3875 [2] https://httpd.apache.org/docs/current/mod/mod_setenvif.html -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=ro_RO.UTF8, LC_CTYPE=ro_RO.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages wordpress depends on: ii apache2 [httpd] 2.4.23-4 ii ca-certificates 20160104 ii libapache2-mod-php 1:7.0+44 ii libapache2-mod-php7.0 [libapache2-mod-php] 7.0.9-2 ii libjs-cropper 1.2.2-1 ii libphp-phpmailer 5.2.14+dfsg-2 ii mysql-client 5.6.30-1 ii nginx-full [httpd] 1.10.1-1 ii php 1:7.0+44 ii php-gd 1:7.0+44 ii php-getid3 1.9.12+dfsg-1 ii php-mysql 1:7.0+44 ii php7.0 [php] 7.0.9-2 ii php7.0-gd [php-gd] 7.0.9-2 ii php7.0-mysql [php-mysqlnd] 7.0.9-2 Versions of packages wordpress recommends: ii wordpress-l10n 4.5.3+dfsg-1 ii wordpress-theme-twentysixteen 4.5.3+dfsg-1 Versions of packages wordpress suggests: pn mysql-server <none> ii php-ssh2 1.0+0.13-1 -- no debconf information