skip to Main Content

Someone attacked me with a lot of Google Ads traffic and made the bounce on my website increase and caused the ranking on SEO to fall. In this case I want to do a redirect url with parameters like the following:

source: mydomain.com/?gclid=blablabla

to: mydomain.com/404

all url with this parameter i want to redirect it to 404 page, currently i am using wordpress and redirection plugin. Please help.

Thank You

I want to change target url to 404 from all these parameters : /?gclid=

2

Answers


  1. To redirect URLs with the parameter /?gclid= to a 404 page using WordPress and a redirection plugin, you can follow these steps:

    1. Install and activate a redirection plugin on your WordPress website. Some popular options are "Redirection" or "Simple 301 Redirects."

    2. Once the plugin is activated, go to the plugin settings or find the redirection menu in your WordPress dashboard.

    3. Look for an option to add a new redirection rule or create a new redirect. This may vary depending on the plugin you are using.

    4. In the source URL field, enter /?gclid= (without quotes). This will match any URL that has the /?gclid= parameter.

    5. In the target URL field, enter "/404" or the URL of your 404 page. This will be the destination where the redirected traffic will be sent.

    6. Save the redirection rule and test it by visiting a URL with the /?gclid= parameter to see if it redirects to the 404 page.

    Note: Make sure you set up a custom 404 page on your WordPress website if you haven’t already. You can create a new page and name it "404" or use an existing one. Then, set it as the target URL in the redirection plugin.

    By redirecting these URLs to a 404 page, you effectively inform search engines and users that the original content they were trying to access is not available, which can help mitigate the negative impact on your website’s ranking and user experience caused by the unwanted traffic.

    Login or Signup to reply.
  2. While this is technically a duplicate question, it varies slightly, because the information is available immediately, rather than only after WP loads.

    I don’t know that this can be solved properly with Redirection plugin. If the plugin can identify the query parameter gclid then you could redirect to a URL that doesn’t exist (as you’ve suggested), but that’s probably not best.

    Untested code to add in MU-plugin:

    // If no query parameter, let it through.
    if ( ! isset( $_GET['gclid'] ) ) {
        return;
    }
    
    // Send 404 status and prevent caching.
    status_header( 404 );
    nocache_headers();
    
    // Prevent further processing.
    exit;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search