How to disable access to category pages

You can add something like this in your category.php.

if ( ! is_admin() ) {
     wp_redirect( home_url() );
     exit;
}

This will redirect viewers to website homepage but category pages will be active and accessable to admins only.

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