Last active
December 28, 2022 23:30
-
-
Save florianbrinkmann/7b06b3554572a7d49c55aeefb0950eca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* If registration for new network sites is disabled, | |
* the NOBLOGREDIRECT constant redirects to a specific URL | |
* if a user tries to access a nonexisting network site. | |
*/ | |
// add this to wp-config.php and adjust the URL | |
define( 'NOBLOGREDIRECT', 'https://example.com' ); | |
/** | |
* add this to mu-plugin to keep normal 404 errors | |
* working instead of redirecting to the above specified URL | |
* @source: https://wordpress.org/support/topic/404-page-not-working-after-setting-noblogredirect/#post-4844131 | |
*/ | |
remove_action( 'template_redirect', 'maybe_redirect_404' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment