ErrorDocument 404 /err404.php
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index$|\.php - [L,R=404]
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]