0

I have a fedora40 system with apache-2.4.62 and GSC is reporting many of our URLs that are images, redirects or contain query strings are "duplicate without user-selected canonical."

I've created this method to label PDFs and images with the canonical tag:

RewriteRule (.+)\.(pdf|jpg|webp)$ - [E=FILENAME:$1\.$2]
<FilesMatch "\.(pdf|jpg|webp)$">
   Header add Link "<https://linuxsecurity.com/%{FILENAME}e>; rel=\"canonical\""
</FilesMatch>

However, I have other URLs that contain query strings and can't figure out how to add the above header to them. Here are a few examples.

This one is a redirect. The redirected link is properly defined as being canonical, but apparently the redirected link does not, so GSC thinks the canonical for this link is some external site.

https://www.linuxsecurity.com/resource_files/documentation/virus-writing-HOWTO/_html/rst.html

This one has the canonical set properly without the query string, but GSC is complaining the version with the query string does not.

https://linuxsecurity.com/news?format=feed&type=atom

I think one of the issues is that the two examples above are not "files" so won't work.

1 Answer 1

0

Its probably because each version of an link with different params is looked at as a separate url.

Apply canonical to the url without the query string does not apply to one with the query string.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.