PHP file is downloaded instead after htaccess migration/convertion
August 18, 2022 04:30AM
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!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 111
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready