Why does multisite bypass WordPress for wp-content, wp-admin, wp-includes and .php files?

When you set up WordPress to use multisite, you’re directed to modify your .htaccess file to use one of the following, which are outlined in the admin and the WordPress documentation:

Subfolder

...
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
...

Subdomain

...
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
...

I understand what those rules do. Instead of sending the requests through to WordPress to handle, .htaccess sends the user directly to the directory or file, whether it exists or not.

What I can’t figure out is why. Why is this necessary for multisite, but not for single site installs?

I ask because we’re trying to use the Redirection plugin to create redirects for some files in wp-content/uploads and some files that end in .php. Unfortunately, because those requests don’t make it to WordPress, the redirects are never triggered. We don’t want to modify the .htaccess rules without first understanding their purpose. And that has been a challenge.

0

Leave a Comment