I have a magento2.4 store running on server. I installed it on localhost but it give 404 error.

It has a strange .htaccess file contents.
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/pub/
RewriteCond %{REQUEST_URI} !^/setup/
RewriteCond %{REQUEST_URI} !^/update/
RewriteCond %{REQUEST_URI} !^/dev/
RewriteRule .* /pub/$0 [L]
DirectoryIndex index.php
If i change the .htaccess file content to a standard M2 .htaccess than it gives directory content.

Can you suggest some solution to this problem?