• Hi,

    I had a nasty break-in but all is restored now. What is left are links known to Google Search Console of the form example.com/?y=123456 that I want to return with a 404 so that Google will eventually forget about them.

    But whatever I do, any command line parameter that I add to my sites URL, ends on my sites page, ignoring this parameter.

    I tried

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^[a-zA-Z]=[0-9]+$
    RewriteRule ^ – [R=404]

    to force a 404 on parameters like y=123456, but it does not have any effect.

    I believe, this .htaccess setting is processed, because if I replace [0-9] with a single period to make the value of the parameter a string of any characters, a few pages in the the backend settings pages are mangled.

    I am standing at a complete loss – can anybody shed some light on this?

    Cheers,
    Merlin

    PS: I am using a child of twentytwelve with only minor tweaks.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @merlinsilk,

    In most cases, WordPress ignores the unknown query parameters and serves the requested page. Are you passing any query parameters other than y=123456?

    Are you using any security, caching, or SEO plugins that could be affecting URL handling?

    We hope you are using the latest version of WordPress and have placed the URL rewrite code just above the WordPress block in the .htaccess file.

    Please try the following code after a full site backup and check whether it helps or not.

    RewriteEngine On

    RewriteCond %{QUERY_STRING} ^[a-zA-Z]=[0-9]+$ [NC]
    RewriteRule ^$ - [R=404,L]

    As an alternative, you can also try plugins like https://wordpress.org/plugins/redirection/ for URL redirections.

    Thread Starter Merlin Silk

    (@merlinsilk)

    Thanks for the reply!

    I had been suspicious that WP would just ignore unknown parameters and I am glad that you can confirm this.

    I will try the option for .htaccess you suggested, but using the redirection plugin seems to preferrable and more general solution. Unfortunately I ran into a severe site error and have already asked for help on that.

    Cheers,
    Merlin

    You are welcome. Please try the workarounds after you have fixed the severe error on your site, and let us know your feedback.

    Thread Starter Merlin Silk

    (@merlinsilk)

    Thank you again!

    that [NC] did not seem to make a difference, but I was able to get ‘redirection’ to work (Thanks John for the instructions to remove quickppr_redirects from the options) and now Google can learn that all those links are just 404s.

    Remains to convince Google to come by and take a look.

    Cheers,
    Merlin

    Hi Merlin,

    You are welcome. Happy to know you are getting the expected results using the Redirection plugin 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.