Gorie
Gorie

Reputation: 3

Apache Rewrite Rule gives 404 Paypal IPN Redirection

I have been trying to get a rewrite rule working to redirect my old paypal IPN URL to my new one, I have tried the following in the .htaccess file and cant seem to get it to work, any help would be greatly appreciated!!

   # BEGIN PayPal Fix
   <IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteRule ^/wc-api/WC_Gateway_Paypal/ 
   ^/hosting/modules/gateways/callback/paypal.php [R=307,L]
   </IfModule>
   END PayPal Fix

Another thread on stackoverflow about a similar issue: Change the IPN url on existing subscription See jon G's post about his rewrite, that is exactly what im trying to accomplish!

Thank you for any and all guidance!

Upvotes: 0

Views: 193

Answers (1)

Binarus
Binarus

Reputation: 4405

There seem to be some problems with your rewrite rule.

The minor problem is that it is unusual to write such a rule in two lines. In fact, I am not sure if this is allowed in the form you use; I would expect that there would have to be at least a line continuation character. So I would put the rule into a single line first.

But the main problem is in the target of your rewrite rule. While the first part of a rewrite rule is a search pattern (regular expression), the second part (target) isn't, so you should leave away the leading ^.

Your rule then should look like this:

RewriteRule ^/wc-api/WC_Gateway_Paypal/ /hosting/modules/gateways/callback/paypal.php [R=307,L]

But I am wondering why there is no script name in your search pattern. Do you really want to map a directory to a script? Or does WC_Gateway_Paypal just appear as directory, but in fact already is mapped to a script by a rewrite rule which is evaluated before?

Upvotes: 0

Related Questions