Wordpress multisite configuration

Hi everyone,

I’m trying to setup a wordpress multiste (subfolder type) on platformsh.
The main dashboard (and the network dashboard) work very well, but dashboards for the subsites trigger an infinite 302 loop (on https://xxxx/mysubsite/wp-admin/).

My wp-config seems ok, but I can’t customize the nginx configuration (as shown in several tutorials) with platformsh.

Do you have an idea ?

Thanks a lot in advance

0

Comments

1 comment
Date Votes
  • 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.

 

Didn't find what you were looking for?

New post