How has Google discovered these URLs? If you are linking to these URLs internally then this is something you need to fix.
It's not possible to 301 redirect these URLs because the fragment identifier (fragid) - everything after the #
(hash), including the #
itself, is not sent to the server as part of the HTTP request. You can only issue a 301 redirect from the server.
The fragid is only accessible from your client-side JavaScript (the original purpose of hash-bang #!
URLs). You could potentially detect these fragid(s) in JS and issue a JS "redirect" - but this is just another 200 OK request, not a 3xx HTTP redirect. There may not be much point in doing this, since it's a low signal to search engines and potentially just slows your users. (Users are presumably seeing the same page regardless of whether the fragid is present or not?)
You should, however, set a rel="canonical"
link element in the head
section of your home page with the correct canonical URL. For example:
<link rel="canonical" href="https://www.example.com/">
This informs search engines of the canonical URL for the page/URL currently being requested.
Note, there should always be a slash after the hostname, eg. https://www.example.com/
. If this is omitted (in the search results) then it's just aesthetics.