PayPal返回地址被自动添加前缀致404,如何保留原跳转地址?
Hey there, let's get that return URL sorted out—this is a super common gotcha with PayPal's standard form integration!
The root of your problem is that you're using a relative URL (newnumyspace.co.uk/purchase-success.php) instead of a full absolute URL. PayPal treats relative paths as being relative to its own domain (paypalobjects.com), so it automatically prepends that prefix, leading to the broken 404 link.
Here's how to fix it step by step:
Use a complete absolute URL in your return parameter
Update your hidden input to include the full protocol (https://) and domain. Your code should look like this:<input type="hidden" name="return" value="https://newnumyspace.co.uk/purchase-success.php">This tells PayPal exactly where to send users, no guessing or prefixing needed.
Double-check the parameter name
Make sure you're using the correct lowercasereturnparameter (this is the right one for PayPal's standard HTML form payments). Avoid typos likeReturnorRETURN—PayPal's form parameters are case-sensitive in some contexts.Verify your target page is accessible
Before testing, pophttps://newnumyspace.co.uk/purchase-success.phpinto your browser to confirm it loads correctly (no 404s). Even if PayPal sends users there, a broken page will still cause issues.Check your PayPal account settings (optional)
Log into your PayPal Business account, navigate to Website Payment Preferences, and ensure "Auto Return" is enabled. While the form'sreturnparameter should override account settings, enabling this ensures PayPal honors the redirect instead of showing its own success page.
Once you make that switch to the full absolute URL, PayPal will stop adding that unwanted prefix and send users straight to your purchase-success page.
内容的提问来源于stack exchange,提问作者cdogmillionaire

