<IfModule mod_rewrite.c>
  RewriteEngine On

  # Redirect all http or www to https://allformasti.com/
  RewriteCond %{HTTPS} off [OR]
  RewriteCond %{HTTP_HOST} ^www\.allformasti\.com$ [NC]
  RewriteRule ^(.*)$ https://allformasti.com/ [R=301,L]

  # Serve existing files or directories normally
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  # For all other requests, serve 404.html with 404 status
  RewriteRule ^.*$ /404.html [L,R=404]
</IfModule>

# Specify the custom 404 error document
ErrorDocument 404 /404.html