htaccess在同一个文件中有两个命令

Hi i have my htaccess with this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.htm [L]

ErrorDocument 404 /404.htm

if i erase the first 4 lines, the other piece of code (which redirects de 404 page when there's a page not found) does not work anymore.

Any ideas? I also want that when it redirects to 404.htm, it does not show on the url box, this url

http://www.mypage.com/404.htm

i want to show this

http://www.mypage.com/fail/search-by-the-user

for example.

Try following .htaccess

RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ /$1.html

ErrorDocument 404 /404.html

NOTE: if you are working at localhost then please mention proper RewriteBase