I am building a webhook for Exact Online. I registered my webhook subscription url as: https://www.example.com/webhooks/exact/orders/
In .htaccess I rewrite this url:
Options +FollowSymlinks
Options -MultiViews
RewriteEngine on
RewriteRule ^webhooks/exact/orders/$ /webhooks/exact-orders.php [NC,QSA,L]
In the php file I echo the post input:
echo file_get_contents('php://input');
When I test this with postman it does not output anything but when I change the url to https://example.com/webhooks/exact-orders.php in postman it works.
So the post is lost when the url is rewritten. Is there a way to prevent this or do I have to change my webhook subscription url?
I am using the same rewrite rule for webhooks from other companies and they work fine.
After some testing I found out that the problem had nothing to do with the redirect from
/webhooks/exact/orders/towebhooks/exact-orders.phpThe POST was lost because of the redirect from
https://www.tohttps://In the server settings I found a setting called 'Prefered domain'. It explained:
When I switched the prefered domain to 'None' the problem was solved.
As an alternative solution I could change my webhook subscription to an url without the www. prefix
I hope this wil help someone in the future.