WordPress Multisite 404 error on posts and subsite

2019-08-20 07:03发布

问题:

I have installed WordPress multisite and my main site is working but the posts and subsite going to 404 I searched a lot and no luck. my Wordpress is configured in the subdirectory at http://arabyouthsurvey.com/newsite/media-center/

I have two sites in it.

Site 1: it is working but it's posts going to 404. I can access the wp-admin for this site too.

Site 2: it is completely going to 404. also cannot access wp-admin

Here is my htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /newsite/media-center/
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

I added these lines on my wp-config.php

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'arabyouthsurvey.com');
define('PATH_CURRENT_SITE', '/newsite/media-center/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1); 

I have no extra plugin installed and I tried by deactivating all plugins but the issue still exists.

回答1:

So I struggled and struggled with this error I'd moved an existing working server to a new Ubuntu 16.xxx server and it all went t***ts up.

Wordpress - MultiSite - SubDomain install Main site working correctly like - www.domain.com

Subdomain sites like testing.domain.com OR www.anotherdomain.com

  • would work correctly but only on their default home page
  • would work correctly on pages and posts if using post ID rather than pretty permalinks.

.htaccess file was all according to the recommended settings wp-config.php all set up similarly

Sites vhost config files for subdomains configured correctly

<VirtualHost *:80>
        DocumentRoot /var/www/html/web04
        ServerName subsite.domain.uk
        ServerAlias www.subsite.domain.uk subsite.web04.domain.uk

  ServerAdmin webmaster@domain.uk

    <Directory "/websites/www/html/web04">
            order allow,deny
            Allow from all
            AllowOverride All
            Options -Indexes +FollowSymlinks
    </Directory>

    LogLevel debug rewrite:trace8

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

</VirtualHost>

THE ISSUE WAS

/etc/apache2/apache2.conf

MAKE SURE THAT THE FOLLOWING LINES ARE CORRECT AND CHANGE THE DEFAULT OF

AllowOverride None to All

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted 
</Directory>


回答2:

Fixed this issue by changing php configuration of my server

it was serving php by nginx i changed it to apache and my issue gone.