multisite 404 error for subdirectory

All we need is an easy explanation of the problem, so here it is.

I am attempting to create a multisite as a subdirectory and I have followed the network instructions to the ‘T’. The multisite seems to be set up correctly, the .htaccess and wp-config.php files seem correct and I was able to do a network setup, however when I go to my multisite page it comes up with a 404 error – Not found. This also then prevents me from logging into the admin side for this site.

My main site still works fine and I able to login to the admin side there and with help from a plugin I can access and manipulate the database. All newly created tables are there, the multisite URL and options all seem correct.

I’ve verified the .htaccess file matches what’s in WordPress.
I’ve verified the appropriate location of .htaccess (public_html root) and it is writeable. We don’t believe this is a permalinks problem as so much of my research has suggested.

After extensive research I was unable to find a solution, any help is appreciated.

Here is my .htaccess file:

<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>

and the end of my config file:

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'www.mybusinessconnect.com.au');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

I had the axact same problem.

My solution: edited/etc/apache2/sites-enabled/000-default.conf. It needs to look like:

<VirtualHost *:80>

        ServerAdmin [email protected]
        DocumentRoot /var/www/html

        <Directory />
                Options FollowSymLinks
                AllowOverride all
        </Directory>
        <Directory /var/www/>
                Options FollowSymLinks
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

It works!

Method 2

I faced same problem – wordpress multisite directory – 404 error for new site dashboard and site page, admin site and dashboard works.

My problem was in apache configuration – /etc/apache2/httpd.conf. Need to do ‘AllowOverride All' under Section <Directory "/Users/user1/Sites">

And don’t forget to enable mod_rewrite in httpd.conf:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Otherwise it gives 500 error.

I don’t know what these config represent, but this solved my problem. Hope this helps.

Method 3

I had the same problem and I tried everything! I found that there was no DOT in front of my htaccess file! I am using windows and somehow the dot got removed.

To add a dot in front of a file in Windows, rename the file .htaccess. and windows will remove the last dot and leave the first one.

Method 4

I’d like to mention one potential cause, which is rather obvious, but actually quite hard to detect: The use of disallowed characters in the path fraction of the sub-site URL.

As stated in the WordPress Codex:

Site Address: Only the characters a-z and 0-9 permitted.

The usage of disallowed chars (f. ex. dots) in the subdirectory path makes the rewrite rules in .htaccess file not to trigger, resulting in 404 responses from the server.

Having worked for several years with professional WordPress projects, I felt myself at least somewhat competent on the topic, but must admit I just spent 2-3 hours debugging the problem, and then realized I had made a beginner mistake. 🙂

Method 5

According to WordPress, these htaccess rules are for multisite https://wordpress.org/support/article/htaccess/

#Subfolder Example

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]

#SubDomain Example

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]

That’s what I used without problems on a hosted site.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply