Can’t redirect to previous page after using GET

  1. Do you have exit(); after the header(... ?
  2. Do you issue the header() before any headers are sent already?
  3. If that’s a WooCommerce then I believe you are doing it wrong. Instead, you should enable AJAX adding to cart (that’s not straightforward on the individual product listings, and you may need to modify the default WC template for that). If you redirect after “?add”, you may lose the WC “added to cart” notice. See how it’s done, for example here.

error code: 523