0

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!

Gorie
  • 3
  • 1

1 Answers1

0

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?

Binarus
  • 4,005
  • 3
  • 25
  • 41
  • Hey sorry for late response! – Gorie Oct 22 '17 at 04:43
  • It was so convaluted i decided to just get the clients to re-sub it was easier than i thought, just some phone calls sorry i was not able to get it to work :( I think it was becasue its not supposed to work like that as you said no script/mapping to directory the reason it was like that is because the old Paypal IPN url was that, and the new one was the hosting one. – Gorie Oct 22 '17 at 04:49
  • Thanky you for your help :) – Gorie Oct 22 '17 at 04:49