2

The website is built in wordpress.

I do not have than much experience, so I need your help. Once I entered at “Search Console” at “Crawl Errors” tab I saw that all “404 errors” are in “wp-content/uploads” and most of them are .pdf
I noticed than it adds text after the suffix of .pdf.

1st example:

At “Crawl error” it appears “Error 404” on this link :

https://example.com/wp-content/uploads/2016/10/salon-du-livre-octobre-2016_2-2.pdf;salon-livre-octobre-2016_2-2

When I try to get in, it says “File not found”. If I delete the suffix ;salon-livre-octobre-2016_2-2 from the link then I have access to .pdf. The link will be:

https://example.com/wp-content/uploads/2016/10/salon-du-livre-octobre-2016_2-2.pdf

2nd example:

https://example.com/wp-content/uploads/2017/10/marmara.pdf;

If I delete the ; symbol suffix then the link works.

I tried to redirect with Yoast.

1st attempt:

Old URL: https://example.com/wp-content/uploads/2016/10/salon-du-livre-octobre-2016_2-2.pdf;salon-livre-octobre-2016_2-2
New URL: https://example.com

2nd attempt:

Old URL: https://example.com/wp-content/uploads/2016/10/salon-du-livre-octobre-2016_2-2.pdf;salon-livre-octobre-2016_2-2
New URL: https://example.com/wp-content/uploads/2016/10/salon-du-livre-octobre-2016_2-2.pdf

Neither of these two worked.

Is there any way to redirect these PDFs?

What can I do with the problem of “Crawl Errors”?

I'm using Attachment File Icons (AF Icons) plug in for pdf by Praveen Rajan And All 404 Redirect to Homepage By Fakhri Alsadi.

List of crawl errors

5
  • Did these files ever exist? If not, then it appears that these are bots following links made on compromised / hacked computers with the assumption that your site has also been hacked. This is script kiddie stuff. Your site is likely on a list of compromised systems that compromised systems use to make links. In this case, do nothing! Except of course making sure your site is up to date including plugins and templates. A 404 is the proper thing.
    – closetnoc
    May 21, 2018 at 20:11
  • These all files exist on my site, If I delete the symbol of “;” at the suffix then the link works and you have access at the file (.pdf)
    – Chris
    May 21, 2018 at 20:28
  • Okay. You need a 301 redirect that takes a PDF url with a comma and modify it to the correct file. If there is a clear pattern then a good regex should allow you to have just one redirect. This is not my area of expertise any more since I have been retired for a while. However, there are users who can help. Are you using Apache?
    – closetnoc
    May 21, 2018 at 20:56
  • "If I delete the symbol of “;” at the suffix then the link works" - Are you suggesting that you are linking to the invalid URL? Or that the links on your site are OK, but these errors are still being reported? Your "2nd attempt" looks correct, but you say "None of these 2 worked."?
    – MrWhite
    May 22, 2018 at 12:19
  • 1
    @MrWhite In my site all links works! But they aren’t with that “;” at the suffix. Why appears on my google search console in all my pdf?? Yes normally the 2nd attempt should work, but when I tried to do the redirect with Yoast and Redirection plugin didn’t do it. I mean when I click at the link after use the plugin example.com/wp-content/uploads/2016/10/… didn’t redirect me at the example.com/wp-content/uploads/2016/10/… When I redirect pages work fine.. but not with .pdf files.
    – Chris
    May 22, 2018 at 17:18

1 Answer 1

1

To correct these crawl errors and redirect to remove the part after and including the semicolon (;) then you can do something like the following near the top of your .htaccess file:

RewriteRule ^(wp-content/uploads/[^;]+\.pdf); /$1 [R=302,L]

This must go before the WordPress front-controller, otherwise, it will have no effect (which may be part of the problem you are facing).

Change the 302 (temporary) redirect to 301 (permanent) only once you have tested to make sure this works OK.

However, as to why these crawl errors appeared in the first place is another matter - and this may still require your attention.

2
  • Thanks for your answer but I can't use .htaccess as I use NGINX server.
    – Chris
    May 22, 2018 at 18:21
  • Ah, sorry, I missed that nugget!
    – MrWhite
    May 22, 2018 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.