Redirect Paypal IPN (nginx best)

Hi - I seem to be too stupid to understand how to redirect the paypal IPN - please help me if you know. Should be interesting soon for others too as s2member is dying - and even folllow up plugins will likely due to copyright need to use a different handler.

This is not working.

location / {
rewrite ^/?s2member_paypal_notify=1 ^/?optimizemember_paypal_notify=1 redirect;
rewrite ^/?s2member_pro_stripe_notify=1 ^/?optimizemember_pro_stripe_notify=1 redirect;
try_files $uri $uri/ /index.php?$args;
}

I need to redirect the IPN from
domain.org/?s2member_paypal_notify=1
to
domain.org/?optimizemember_paypal_notify=1 redirect;

If you know how to do this with htaccess - also fine then I could try a converter (but better nginx format )

Hi,
Why don’t you change that in PayPal settings rather than rewrite option?

That’s not changing past created. Need a rewrite or 301/302 return.

Hi,
I’m maybe stupid but I don’t understand why do you want to change PayPal notify setting for olders transactions…
Old payments have already been made successfully, so you just need to secure future payments, right?
Or maybe PayPal’s notifications serve something else that I do not know…

First of all I have 2 websites - so the paypal IPN settings don’t matter anyhow as I set custom IPN in each transaction.
2. If you set custom IPN - the setting has no effect. The standard of s2member is setting custom - actually I think the only reason to setup anything at paypal is so that paypal knows that there is an IPN responding - what you enter does not matter at all as long as you use the custom IPN.
3. You cannot change the custom IPN in the future - so for subscription payments incoming - you need to redirect the IPN.

I just checked - new IPN messages and all additional integrations (like Quaderno.io) work without problems. It’s the old custom ones - I really need to find out how to redirect the IPN to the new handler!
This will be the same for any membership plugin change (if you have not defined in the new membership system to also listen to the old handler).

Okay - After trying to find solutions for hours - which all did not work - I finally got it:

location = / { 
if ( $args ~* "s2member_paypal_notify" ) {
set	$args "optimizemember_paypal_notify";
rewrite ^.*$ https://www.velomap.org/ permanent; 
} 
try_files $uri $uri/ /index.php?$args;
}