Trying to migrate a PHP website from Apache to nginx. All done but we’re just having a redirection URL problem.
The website is a payment link system. Here's the htaccess file inside public_html/pay folder:
php_flag opcache.enable Off
RewriteEngine On
RewriteBase /pay/
RewriteRule ^result$ result.php [QSA,L]
RewriteRule ^([a-zA-Z0-9-_]+)$ index.php?url=$1
I converted it to NGINX configuration via getpagespeed, so here's the result:
rewrite ^/result$ /pay/result.php last;
rewrite ^/([a-zA-Z0-9-_]+)$ /pay/index.php?url=$1;
While there's no problem on pending payment links, the expired ones are downloaded because of the redirection I guess. For example, this link opens on both Apache and NGINX servers:
https://example.com/pay/M-168102-2432
But let's say this payment link has expired or paid or something else. Not active anymore. So it is redirected to:
https://example.com/pay/result?u=M-171824-2640&status=99
There's no problem on Apache, however, NGINX downloads the result.php file (no file extension though, just a file named "result".)
Do you have any suggestions?
Thanks in advance!