im reinstall server on Ubuntu 20.04 with control panel "Hestia" 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. If i comment this rules - all works and front page too, but i not have my 404 page.
Please help convert my .htaccess to php-fpm friendly. What i need to do?
CodePudding user response:
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