Skip to main content

Wordpress multisite configuration

Comments

1 comment

  • Paul Gilzow

    I can definitely help out here. Changing/adding rewrite rules is handled inside of the web:locations:<location>:rules section of your .platform.app.yaml configuration file.

    Link to the docs about rewrites.

    For a WordPress directory-based multisite, we’ll need to replicate the WordPress .htaccess rules into rules inside of our configuration:

            ################################
            ###        WORDPRESS        ###
            ###############################
            # We need to allow requests to wp-login.php to pass through
            # Multisites do not respect the WP_SITEURL constant in Wp-config.
            # In addition, directory-based multisites include the virtual directory before the wp-login.php
            '^/([_0-9a-zA-Z-]+/)?wp-(?<wproot>[a-z\-]+).php$':
              allow: true
              scripts: true
              passthru: '/wp-$wproot.php'
            # Allows directory-based multisites to still access the wp-admin and wp-include locations
            '^/([_0-9a-zA-Z-]+/)?(?<adminrewrite>wp-(admin|includes).*)':
              allow: true
              scripts: true
              passthru: '/$adminrewrite'
            '^/([_0-9a-zA-Z-]+)/wp-content/(?<content>.*)':
              allow: true
              scripts: false
              passthru: '/wp-content/$content'
              expires: 1w
    

    Or you can see it here as part of a full .platform.app.yaml file (the gist is old so ignore the php 7.4 :wink: )

    Given you can see the network dashboard, I’ll assume you’ve already added the necessary cookie values to your routes.yaml file?

    0

Please sign in to leave a comment.