404 on wp-admin pages, multisite, non-mapped domains only

Greetings all,

I'm not sure when this issue actually popped up, but we're now getting 404 errors attempting to load the dashboard page on all of our non-domain-mapped sites (i.e., subdirectory sites only -- the ones that are mapped to domain names are still okay). To the best of my recollection, we haven't changed anything recently at the server level, nor has anything in WP been touched in quite some time, other than the most recent WP update. I did a quick rename of .htaccess but the 404 still occurs. Research on the problem has so far been fruitless. At this point we're stumped. Any suggestions would be appreciated.

  • Patrick

    Hey there squibm

    I hope you're having a great day!

    Do you have access to your network admin? Can you please check both your htaccess and wp-config.php files to see if they are appear exactly as indicated under Settings > Network Setup?

    It would help if you could post the contents of those files here too... please remember to use the code button above so the code actually stays as code. :wink:

  • squibm

    Hi Patrick,

    Thanks for the reply. wp-config.php matches up with Settings -> Network, but .htaccess is a different story. The WP section looks like a single-site version:

    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    

    This was the result of my last yell for help here and the suggested fix was the htaccess snippet above. It might be worth mentioning that using the rewrite rules provided by WP really mess with URLs having a trailing slash. The rules in question are:

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

    It's the question mark that was causing the trouble. In one iteration, I removed those question marks and things started working, or at least to some degree.

    I wrapped the code above in pre and code tags, hopefully this editor will react properly.

  • Patrick

    Hi again squibm

    Perhaps a sample from a fresh site might help. This is from the htaccess of my test network, which is a fresh install of 4.7.2:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
  • squibm

    Hi Patrick,
    The above rewrite rules didn't change the situation. The 404 still occurs attempting to access wp-admin.php. I think this "variation" is probably "more correct" for multisite, but I believe the problem lies elsewhere. My gut tells me this might be related to domain mapping. The dashboard on the domain-mapped sites are accessible (and to answer your previous question, yes, the main site's dashboard and the network admin dashboards are accessible) -- but the non-mapped sites produce the 404. I left your rewrite rules in .htaccess, just FYI.

  • squibm

    Well, this is embarrasing.

    The htaccess changes you suggested did have one effect: the styles for the login page disappeared. That told me that htaccess was definitely part of the equation. So I decided to go ahead and copy the rewrite rules from the Network->Setup page and eegads, it worked! This is a bit scarey since I do recall having other issues related to those rules. For now, I guess we can call this a wrap, but as Han Solo once famously said, "I have a bad feeling about this..."

    Thanks for your assistance, it's appeciated...

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.