I have been getting this kind of results in google search console i cannot clean them i guess my website is affected with malware. Can you guys help?
https://prnt.sc/ufx9bEOoZka8

It looks like people are typing random spam into your search queries. Your search results page should be noindexed or blocked in robots.txt.

how do i block it ?

Sorry, I didn't see your response until now. To block Google from wasting its time crawling all these random search queries, you can create a robots.txt file at your root domain: e.g. www.example.com/robots.txt and put the following in it:

User-agent: *
Disallow: /*?q=

Basically what those two lines mean are that all bots visiting your website should never crawl URLs that are in the format /<blah>?q=<blah>

This will block all of those URLs in search console. In my experience, it's often a good idea to block all search queries because Google doesn't ever want to rank your search result pages in its search results (it wouldn't make much sense for someone doing a Google search to be pointed to yet another search results page). Also, there are a theoretical infinite number of search result pages since users can type in any freeform search text they want. However, be careful that there aren't any URLs on your site in which there is a ?q= parameter that is not denoting a search query. You don't want to block pages you don't mean to.

Hope this makes sense.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.