Forum Moderators: phranque

Message Too Old, No Replies

how to block unwanted query string on end of url

this messes up canonical tags in GSC

         

Lorel

4:52 pm on Oct 22, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I got a warning from GSC that several pages have the wrong canonical tag however they all have query strings added on the end of the url like this:

https://www.example.com/pagename.html?ref=example2.com

Question1: Is this caused by someone redirecting the page to example2.com

Question2: How to I prevent this for all affected pages via htaccess?

PS. I never use query strings on my site.

Lorel

5:07 pm on Oct 22, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



PS. canonical tags are correct.

not2easy

5:26 pm on Oct 22, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Do you have a site search? That would generate such strings.

And yes, those examples can be generated by example2.com as referer. Usually you don't want search results pages indexed because they are duplicates of other pages. If the links originate on the example2.com site, I would be curious about why and how.

You should check your logs to verify the activity.

not2easy

5:46 pm on Oct 22, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Second scenario - you don't care why links from another site point to your content. In that case you can block the referer. There are many examples to block referer around here.

If you dig deeper and find your content on the example2 domain (perhaps via iframe) you can block that, but without investigation it would not really help to explain how.

Lorel

7:21 pm on Oct 22, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ahhh. Yes, I have site search. Thanks. I'll try that before trying the others.