Git Product home page Git Product logo

Comments (2)

Dreamsorcerer avatar Dreamsorcerer commented on July 26, 2024

This seems to be working correctly for us on a multisite. The only thing that needed to be changed was the server rewriterule in the config/htaccess.

The default WP .htaccess has this:
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
Which essentially rewrites the path to strip out the subdirectory. The problem with this, is that when the file doesn't exist and it falls through to index.php the REQUEST_URI is still the original path. To solve this, change [L] to [P] which will perform a proxy redirect and use the rewritten URI instead. Note, you'll need to enable mod_proxy_http for this to work correctly.

Given that is all I needed to do to fix multisite support, can we replace the fail message with an admin notice that can instead give some tips on how to set it up?

from uploads-by-proxy.

Dreamsorcerer avatar Dreamsorcerer commented on July 26, 2024

My actual rules in a <Directory> block as part of a VirtualHost, in case anybody has any trouble (this has actually been tweaked to work with multisites that use multiple levels of subdirectories).

<IfModule mod_rewrite.c>
    RewriteEngine On

    # add a trailing slash to /wp-admin
    RewriteRule ^(.*/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule "/.+(/(wp-content|wp-admin|wp-includes|.*\.php$).*)" $1 [P]
    RewriteRule ^ /index.php [L]
</IfModule>

If you have SSL enabled, you'll also need to add to your SSL section:

SSLProxyEngine on

from uploads-by-proxy.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.