1

I have a woocommerce site that runs a script for accounts that has stopped working after moving from Apache to Nginx.

example.com/zynk/index.php/wp_posts?select=ID,meta_value&where=post_type....

The script gets the parameters using

$urlParts = explode('/', $_SERVER['PATH_INFO']);

This now returns a 404 on Nginx.

I think the following .htaccess rules allowed this script to fire on Apache:

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

But I can't get this working on Nginx.

I've tried:

location /zynk {
  index index.php;
    try_files $uri $uri/ /index.php$request_uri?;
}

However, this does not seem to work.

I could be barking up the wrong tree? or do I just have the rewrite rules wrong?

MrWhite
  • 12,647
  • 4
  • 29
  • 41
Dan C
  • 11
  • 1
  • 1
    You need to implement a location to process PHP - and it needs to accept path info. There is [an example here](https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/) and you may find other examples on Server Fault. – Richard Smith Nov 14 '18 at 15:15

0 Answers0