?cat=-1 Indexed Versions Of Homepage

I'm finding some strange query strings on my homepage are indexed in Google and causing duplicate content. A couple of examples: https://sciencetrends.com/page/103/?cat=-1 https://sciencetrends.com/?cat=-3

I'm not sure how or why these pages are being created in Wordpress but it seems common for even large Wordpress sites: https://techcrunch.com/page/10/?cat=-1 https://blogs.wsj.com/law/page/10/?cat=-1 https://www.nytco.com/page/10/?cat=-1 http://www.bbcamerica.com/page/10/?cat=-1

Ideally, I'd like to remove all ?cat=* pages from the site and have then resolve to 404. Any thoughts on the best method to do so, .htaccess, Wordpress modification, etc.?

Topic rel-canonical tax-query categories pagination Wordpress

Category Web


if (isset($_GET['cat']) && $_GET['cat'] == -1) {
      header('Location: 404.php');
      exit;

Add this to your function.php file.

I also faced the same issue on my website. Every time I published a new article, the URL was not getting indexed in search engine and instead of URL, this unknown category shows up: (?cat=-1)

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.