Support » Plugin: Wordfence Security - Firewall & Malware Scan » Weird frontpage URLs indexed in Google

  • Recently I started noticing my homepage ranking results in Google changed. Normally just the homepage url was indexed and ranked, now when Googling some keywords, strange homepage url variations showup in Google. I found 3 of them:
    mywebsite.com/?option=com_content&view=frontpage&Itemid=28
    mywebsite.com/?option=com_content&view=frontpage&Itemid=75/
    mywebsite.com/?option=com_k2&view=item&id=2%3Ahow-it-works%3F&Itemid=55

    All these urls display the homepage and I have no idea where they came from or how to remove them.

    I found a solution below, I just need to know how to include com_k2 in the statement as well.

    Thank you very much.

    add_action( 'wp', 'force_404_bad_query' );
    function force_404_bad_query() {
    	if ( (isset($_REQUEST["option"]) && ($_REQUEST["option"] == "com_content") )) {
    		status_header( 404 );
    		nocache_headers();
    		include( get_query_template( '404' ) );
    		die();
    	}
    }
    • This topic was modified 4 years, 4 months ago by ezflow.
Viewing 1 replies (of 1 total)
  • Hi,
    this should work

    if ( (isset($_REQUEST["option"]) && ( ($_REQUEST["option"] == "com_content") || ($_REQUEST["option"] == "com_k2") ) ) ) {
    	status_header( 404 );
    	nocache_headers();
    	include( get_query_template( '404' ) );
    	die();
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Weird frontpage URLs indexed in Google’ is closed to new replies.