404 not working on main site on multisite

The cause of your problems is this line:

define( 'NOBLOGREDIRECT', 'http://www.ncc.my' );

If a user visits a blog that doesn’t exist, e.g. http://example.ncc.my this is where the user is sent. However there are also sub directory installs, so all requests that aren’t found are sent there.

The easy fix would be to set up a page called 404 at ncc.my/404 and then change the define to:

define( 'NOBLOGREDIRECT', 'http://www.ncc.my/404' );

The code fix, which is almost as easy, but gives exactly what you want is to create an MU plugin that removes a filter. To do this, create a file called fix404s.php inside the wp-content/mu-plugins folder ( you may need to create the mu-plugins folder. Inside it, put:

<?php
remove_action( 'template_redirect', 'maybe_redirect_404' );
?>

Credit to this blog post for that fix. With that file and those contents in place, your issue should dissapear

tech