404 error - Multisite new sites not found(404), main site still works

admin2025-06-04  0

Closed. This question is off-topic. It is not currently accepting answers.

Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?

Closed 6 years ago.

Improve this question

I followed wordpress guide to install multisite. My main site (mydomain) works well, my multisite is based on subdirectory i.e., (mydomain/test/), however it doesn't load at all (404 error). more details

 $ cat .htaccess

 RewriteEngine On
 RewriteBase /wordpress/
 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]

 $ cat wp-config.php

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

 define('MULTISITE', true);
 define('SUBDOMAIN_INSTALL', false);
 define('DOMAIN_CURRENT_SITE', 'mydomain');
 define('PATH_CURRENT_SITE', '/wordpress/');
 define('SITE_ID_CURRENT_SITE', 1);
 define('BLOG_ID_CURRENT_SITE', 1);

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

It will be great if you can help to fix it. thanks

Closed. This question is off-topic. It is not currently accepting answers.

Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?

Closed 6 years ago.

Improve this question

I followed wordpress guide to install multisite. My main site (mydomain) works well, my multisite is based on subdirectory i.e., (mydomain/test/), however it doesn't load at all (404 error). more details

 $ cat .htaccess

 RewriteEngine On
 RewriteBase /wordpress/
 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]

 $ cat wp-config.php

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

 define('MULTISITE', true);
 define('SUBDOMAIN_INSTALL', false);
 define('DOMAIN_CURRENT_SITE', 'mydomain');
 define('PATH_CURRENT_SITE', '/wordpress/');
 define('SITE_ID_CURRENT_SITE', 1);
 define('BLOG_ID_CURRENT_SITE', 1);

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

It will be great if you can help to fix it. thanks

Share Improve this question edited Jun 29, 2014 at 16:32 Pieter Goosen 55.5k23 gold badges117 silver badges211 bronze badges asked Jun 29, 2014 at 16:11 kuruvikuruvi 1111 silver badge2 bronze badges 5
  • 1 You turned Pretty Permalinks on, presumably? Are you able to view your server's log files (access and/or error logs) to see what request is actually being made on the server? – Pat J Commented Jun 29, 2014 at 16:36
  • Permalinks set to default, I just enabled log define('WP_DEBUG', true); on wp-config.php, but I can't see debug.log file under /wp-content/. – kuruvi Commented Jun 29, 2014 at 19:40
  • More details, I reinstalled. Previously I had subdirectory in the URL (I did set under setting/general), now everything is in my root folder. After the multisite installation, I'm facing new problem, i.e., the new site does open but without any styles (html inspector says it is looking for CSS under my domain/test/wp-includes.......). This is of course wrong!! I'm nginx web server. How do I fix this? – kuruvi Commented Jun 29, 2014 at 20:17
  • I don't believe Nginx uses .htaccess files, at least not out of the box. Googling 'convert .htaccess for nginx' may help you. – Pat J Commented Jun 30, 2014 at 0:55
  • Possible duplicate of multisite 404 error for subdirectory – WPZA Commented Jan 20, 2019 at 1:14
Add a comment  | 

1 Answer 1

Reset to default 3

I've faced the same error with both Nginx and Apache installed. Nginx works as a reverse proxy and serves static files. Because of this reason you have to insert the following code inside server directive:

if ( !-e $request_filename ) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;  
    rewrite ^(/[^/]+)?(/wp-.*) $2 last;                     
    rewrite ^(/[^/]+)?(/.*\.php) $2 last;                   
}

If you use Nginx as reverse proxy for static files you have to put the code listed above inside a location. i.e:

location ~ ^.+\.(jpg|jpeg|gif|png|webp|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|JPG|JPEG|GIF|PNG|ICO|CSS|ZIP|TGZ|GZ|RAR|BZ2|DOC|XLS|EXE|PDF|PPT|TXT|TAR|WAV|BMP|RTF|JS) {
if ( !-e $request_filename ) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite ^(/[^/]+)?(/wp-.*) $2 last;
    rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}

If you run nginx + php-fpm (no Apache and further url rewriting with mod_rewrite involved) you have to put the code inside server directive.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748993983a315456.html

最新回复(0)