Support » Fixing WordPress » Links to PDFs work, yet same URLs return a 404 error…

  • Hello,

    I have this strange problem with PDF files where if I access them from a link on a page, they work, but if I copy-paste the same link in the address bar, I get a 404 error page. For instance, see “Le regard de l’Autre : les récits de voyage en traduction au Venezuela et en Colombie aux 18e et 19e siècles.” on http://www.histal.net/projets/; the link works if you click on it, but try and copy-paste the link’s URL in the address bar and you’ll get a 404 error. What could be the cause of this?

    Likewise, some links won’t even work, but I can’t see any difference between the ones that work and those that don’t. For instance, see “El papel de la traducción en el proceso de independencia de Venezuela (1780-1830).” on http://www.histal.net/projets/; this one just returns a 404 error page, even from the link, yet I can’t see any difference between this one and the previous one which, at least, works from the link (not from the URL though).

    I’ve tried disabling plugins, I’ve fixed the critical errors shown on the “Site Health Status” page, and, as far as I know, all the themes, plugins, etc. are up to date. I didn’t build the website myself, I’m merely updating it, so it’s hard for me to find what could cause such a weird issue…

    Anyway, thank you very much, and please let me know if you need more details!

    Etienne

    • This topic was modified 1 month, 3 weeks ago by etiennelj.

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

Viewing 15 replies - 1 through 15 (of 16 total)
  • >>the link works if you click on it, but try and copy-paste the link’s URL in the address bar and you’ll get a 404 error. What could be the cause of this?<<

    @etiennelj It is not loading for me either ways. First, make sure the file does exist at the given address. Use an FTP client to confirm. Here is how: https://www.ostraining.com/blog/webdesign/filezilla-beginner/

    Let’s say the files exist at the right address, It can be a problem with .htaccess.
    Go tosettings > Permalinks > Save. See if that works.

    Atlast, add the following code in .htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule !(js|ico|gif|jpg|png|pdf|css|swf|flv|libraries|maint|admin|login|logout|reg) index.php [QSA,L,NC]
    </IfModule>

    Let me know how it goes 🙂

    Thread Starter etiennelj

    (@etiennelj)

    Oh, really? It works for me as a link… weird… I’ve also tried the “Permalinks” trick, but unfortunately without success. The files all show up in WP’s “Media Library”, but I’ll try and see directly from a FTP client… Thank you!

    @etiennelj Check if there is an additional .htaccess file in your uploads directory. That maybe preventing some links from not opening pdf resources. Remove it if you found one.

    Also, try and regenerate a new .htaccess file. Here is how: https://wpcompendium.org/wordpress-management/wordpress-troubleshooting/how-to-fix-a-corrupt-htaccess-file/

    Thread Starter etiennelj

    (@etiennelj)

    I’ve just checked the files using a FTP client. The files are there! I can download them, no problem. But somehow, WordPress can’t seem to fetch them… Even the URL for the file I get from the FTP client, which is slightly different from the one used in WordPress, doesn’t work (e.g., http://www.histal.net/clickandbuilds/Histal/wp-content/uploads/2011/07/El-papel-de-la-traduccio%CC%81n-en-el-proceso-de-independencia-de-Venezuela.pdf)

    Thread Starter etiennelj

    (@etiennelj)

    I couldn’t find another .htaccess file in the uploads directory… I’ve tried regenerating a new .htaccess file, and it seems to be working, but when I look in the FTP client, the last modified date of the file isn’t updated…

    Here is the .htaccess file I have:

    AddType x-mapp-php5 .php
    
    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Anything weird or problematic here?

    Thanks!

    @etiennelj It looks fine to me. This is how the default .htaccess looks like: https://wordpress.org/support/article/htaccess/

    I still cannot access the pdf resources though. Try opening the resources in incognito mode.

    Let me know 🙂

    Thread Starter etiennelj

    (@etiennelj)

    Hum… So the .htaccess file is fine…

    It works for me, even in incognito/private mode… I’ve tried in Safari, Chrome and Firefox…

    What on earth could it be…!

    @etiennelj I am on brave but it isn’t loading for me 🙁

    Not even in incognito.

    This is pretty strange.
    Just to be clear. You are accessing it as a user right?
    I meant without logging in.

    Edited to add: I’ve tried on some other devices too. Same result.
    Try it from a different device and see if you can replicate the issue.

    Thread Starter etiennelj

    (@etiennelj)

    I’ve just tried on my iPhone (both Safari and Chrome, in private mode), and it works… I’m not logged in to WordPress or anything… This is driving me crazy!

    @etiennelj Try and save permalinks one more time.
    Let me check a little more thoroughly just to be sure.

    You can use this service: https://www.lambdatest.com/ to test it out on a variety of devices and browsers.

    I have exhausted my credits for the month.
    If possible, give it a try 🙂

    Thread Starter etiennelj

    (@etiennelj)

    Done!
    Thanks!

    What type of test should I perform?

    @etiennelj Use Real time Testing. You will get free minutes for the new signup. Try to access your file from different devices/browsers.

    We can get a good enough idea from that.

    Thread Starter etiennelj

    (@etiennelj)

    Ok!

    @etiennelj If you find the issue persisting on multiple devices/browsers – revert back to the thread, I am sure we can test more thoroughly.

    If it persists in few to none devices/browsers – You can choose to ignore that.
    I tried to dig deep but cannot seem to reach a conclusion. It maybe beyond our control at this point.

    Let me know what the test results say 🙂

    Thread Starter etiennelj

    (@etiennelj)

    I’m not sure how to use LambdaTest… I launch the test, but nothing seems to happen… I’ll check that again later… Thanks!

Viewing 15 replies - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.