Why specific file directory fails to redirect but its parent folder succeeds?

by Guoyang Qin   Last Updated May 08, 2019 03:08 AM

I activated multisite using subdirectories on my old WordPress site, and I created a new site (say my-example.com/new-site/).

I found links such as my-example.com/new-site/wp-content/mu-plugins/css/ can redirect to my-example.com/wp-content/mu-plugins/css/, however, my-example.com/new-site/wp-content/mu-plugins/css/style.css won't redirect and will throw out a 404 error, this leads to the site loading errors.

I was so confused, and tried hard refreshing sites, clearing cookies, but it didn't work.

The .htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


Related Questions


Custom Permalink

Updated September 12, 2016 08:06 AM

Cache Busting using htaccess Rewrite rule?

Updated September 23, 2017 08:08 AM