We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

.htaccess - IPN Phalcon

My biggest apoligies, this was obvious my fault. I have completely forgotten that I had a rule in my index.php that looked for the connecting ip address which actually showed you a coming soon page or actually let you in. I didn't add paypals IP to the list, so it would always land on a coming soon page.

Hey guys, I am trying to create an IPN for paypal. I have done this before and made it work but this time it's different when I try to implement it in Phalcon.

So what I'm trying to do is to send the IPN - cart checkout to a url 'www.example.com/shop/ipn'. When doing this ofcourse .htaccess rewrites it to a HTTPS connection and makes sure 'public/index.php' does not exist in the URL. But I have noticed by routing the connection of the ipn to the correct controller 'shopController' to the action 'ipnAction' it doesn't get triggered. If I would go to the url itself on my browser it gets triggered. But if I try this with Paypal IPN Simulator it does not.

After a copple hours trieng some things like rewriting code and etc.. I tried to change my .htaccess file. Which I think now has a play in it. Because if I create a 'php' file in my root, turn htaccess rewrite off and try the IPN Simulator again it actually works. If I set my htaccess files back my php file wont work anymore.

So the problem is in htaccess, I guess. Is there any reason why phalcon or Htaccess could mess with it? I only have a rewrite condition saying HTTP -> HTTPS and the standard rewrite rule for phalcon index.php in the public folder. I will post my .htaccess content below.

I don't want to create a seperate .php file in my root to receive IPN calls from Paypal because my goal is actually to use Phalcon to create an IPN listener.

.htaccess in root

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    RewriteRule  ^$ public/    [L]
    RewriteRule  (.*) public/$1 [L]
</IfModule>

.htaccess in /public

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>


1.6k
Accepted
answer

My biggest apoligies, this was obvious my fault. I have completely forgotten that I had a rule in my index.php that looked for the connecting ip address which actually showed you a coming soon page or actually let you in. I didn't add paypals IP to the list, so it would always land on a coming soon page.