DirectoryIndex index.php

Options All -Indexes

ErrorDocument 403 http://www.domain.com/forbidden

ErrorDocument 404 http://www.domain.com/error

<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>

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

This is my .htaccess document. I am having problem thats called HTTP Error 500 (Internal Server Error). When i am typing a page name which is not exist in my directory like http://www.domain.com/notexist . I wanted to show the custom error page (ErrorDocument 404 http://www.domain.com/error).

After removing the code below, it works fine, it shows the custom error page (ErrorDocument 404 http://www.domain.com/error).
But when i added this code again it shows the same HTTP Error 500 (Internal Server Error).

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

Error document 403 (ErrorDocument 403 http://www.domain.com/forbidden) is working fine with above code.

Please suggest me...Please help me to get rid of it.