diff --git a/includes/Performance.php b/includes/Performance.php index f6e9d9dec..f69f78359 100644 --- a/includes/Performance.php +++ b/includes/Performance.php @@ -64,7 +64,9 @@ public function __construct( Container $container ) { $this->hooks(); new Cache( $container ); - new Skip404( $container ); + if ( Skip404::is_active( $container ) ) { + new Skip404( $container ); + } new PerformanceWPCLI(); new Constants( $container ); new CloudflareFeaturesManager( $container ); @@ -112,6 +114,11 @@ public function configureContainer( Container $container ) { global $is_apache; } + // Skip .htaccess modifications in local environments (e.g. wp-env, Docker) to avoid 500s from patch/regex issues. + if ( function_exists( 'wp_get_environment_type' ) && 'local' === wp_get_environment_type() ) { + $is_apache = false; + } + $container->set( 'isApache', $is_apache ); $container->set(