App Engine — Product Management UX/UI & Interacion Blog — Frank derFrankie Neulichedl

App Engine

Wordpress MultiSite on Google App Engine PHP Beta

I'm experimenting with Google App Engine PHP Beta to host Wordpress installs. As expected there are some hickups but they are trying hard to make it as easy as possible. With some great plugins etc. The next step for me is obviously to try to make a MultiSite install - and I succeeded. The main challenge is that you need a separate configuration for the local install and the remote one. Here are the steps for a succesful Wordpress Multi-Site install.

Note: This article is in flux and I will update it as soon as I find out more - so come back of follow me on Twitter @derFrankie or Google+ to get updated.

Prerequisites: Having a working wordpress install locally and on GAE following instructions https://developers.google.com/appengine/articles/wordpress

Basic setup

1. Enable Network Support

Edit wp-config.php and include

define('WP_ALLOW_MULTISITE', true);

above /* That's all, stop editing! Happy blogging. */

2. Deploy your install to GAE 3. Create a local network

  •  Login to your local Wordpress Dashboard and disable all plugins.
  •  Then go to /Tools/Network and create a Network
  •  It will tell you that you can only use folders and that you need to copy some information
  •  Create the .htaccess file and forget about the rest (I give you the tight config later on)
  •  Go to the next step

4. Create a network on GAE

* Login to your Wordpress Dashboard on Google App Engine and disable all plugins * Then go to /Tools/Network and create a Network * Choose Folders as install method * Go to the next step

5. Edit Configuration to work locally and on GAE Open your local wp-config.php and enter the following lines above /* That's all, stop editing! Happy blogging. */

Don't forget to insert YOUR_PROJECT_ID

if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) { define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'wp-dot-YOUR_PROJECT_ID.appspot.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); }else{ define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'localhost'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); }

5. Deploy to GAE 

You can now login to both installs and re-enable the plugins if you like and create sites etc. But the sites won't work completely as yet-

Make Sites accessible

Now we want to add additional sites and therefore we need a couple of additional settings.

1. Add some handlers to app.yaml

You need to add these handlers above the other ones

- url: /wp-admin/network/(.+) script: wordpress/wp-admin/network/\1 secure: always

- url: /wp-admin/network/ script: wordpress/wp-admin/network/index.php secure: always - url: /([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*\.(htm.*$|html.*$|css.*$|js.*$|ico.*$|jpg.*$|png.*$|gif.*$)) static_files: wordpress/\2 upload: wordpress/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*\.(htm.*$|html.*$|css.*$|js.*$|ico.*$|jpg.*$|png.*$|gif.*$)) application_readable: true

2. Add additional handlers for every site you add

- url: /YOURFOLDER/wp-admin/(.+) script: wordpress/wp-admin/\1 secure: always

- url: /YOURFOLDER/wp-admin/ script: wordpress/wp-admin/index.php secure: always

3. Ignore local wp-content/uploads

I use the local installation to test out the whole system  - so I have local assets uploaded that don't need to get deployed. To ignore those files add these lines at the end of app.yaml

skip_files: - wordpress/wp-content/uploads/.*

UPDATE July 9th.: Added url handlers to gain access to the admin section for sub-sites UPDATE July 10th: Fixed access to Admin Pages - works now normally