I'm trying to migrate a site under CodeIgniter from Apache to Nginx. My first tests show very good performances, so it worst the try.
But I can't find the correct Nginx configuration to replace those RewriteRules :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
I found this recipe on Nginx website https://www.nginx.com/resources/wiki/start/topics/recipes/codeigniter/
location / {
try_files $uri $uri/ /index.php;
}
It works in most cases, except when I have a trailing slash. Meaning http://example.com/controller/param/
will call http://example.com/controller/function/index.php (and return a 404)
instead of http://example.com/index.php/controller/function/ ...as it usually do with Apache rewrite.
I tried to add a rewrite :
rewrite ^/(.*)/$ /$1 permanent;
But it redirect POST to GET, so I loose all my post data...
Any clue ?
Thanks