Disable NotFound Exceptions in Shopware 6

If you’re experiencing a lot of exception errors in your production environment, this might be caused by Symfony and Shopware’s NotFoundExceptions. These “errors” might cause confusion, but there’s a simple way to get rid of them.

[2023-06-12T13:40:40.742311+00:00] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException:
"No route found for "GET https://shopwareshop.example/url-route"
  1. Login to your webserver using SSH.
  2. Navigate to the root of your Shopware installation path like /var/www/shopware/
  3. Continue to config/packages and find the file “shopware.yaml”
  4. Use your favorite editor (vim, nano etc) nano shopware.yaml
  5. Add the exclude_exception to your Shopware logger
shopware:
  logger:
    exclude_exception:
      - Symfony\Component\HttpKernel\Exception\NotFoundHttpException
      - Shopware\Core\Content\Product\Exception\ProductNotFoundException
      - Shopware\Core\Content\Category\Exception\CategoryNotFoundException
      - Shopware\Core\Content\Product\SalesChannel\Exception\ProductSortingNotFoundException

After this this clear the Shopware cache and you should be golden.

bin/console cache:clear