how to redirect 404 to attachment.php?

Try something like the following at the top of your .htaccess file, before the WordPress front-controller:

RewriteRule (.+/)amp$ /$1 [R,L]

This redirects a request for /<something>/amp to /<something/ – removing the “amp” suffix.

Note that this is a 302 (temporary) redirect.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)