.htaccess convert to php-fpm friendly

Hello, im reinstall server with php-fpm support.
But i have 404 error in front page domain.com/ if i use in .htaccess:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en/|ua/|) $1404.php [L]

All others pages and front page if i add /index ( domain .com/index ) works fine.

Please help convert my .htaccess to php-fpm friendly. What i need to do?

Using rewrite rules for non-existing files to a 404 handler is not the standard way to show a custom 404. I would implement this using the ErrorDocument directive.

  • In $DOCUMENT_ROOT/.htaccess:
ErrorDocument 404 /404.php
  • In $DOCUMENT_ROOT/en/.htaccess:
ErrorDocument 404 /en/404.php
  • In $DOCUMENT_ROOT/ua/.htaccess:
ErrorDocument 404 /ua/404.php