One of my sites has bee hacked. After I cleaned it there are a lot of fake spam URLs in the google. Now I'm trying to set them as 410 Gone and delete them from Google Search Console as well.
What I have tried to add in .htaccess but doesn't show 410 instead is showing 404.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^https://example.com/156224863/scojgmwtdxy-7/cv.def - [L,NC,G]
</IfModule>
If I add this
RewriteRule !^index\.html$ https://example.com/156224863/scojgmwtdxy-7/cv.def [L,R=410]
it is redirecting everything. Even root domain https://example.com/ which I don't want to.
What I miss here?