Yes, that is a problem I encountered this weekend with a long-time client. It was FRUSTRATING for all of us! The client was sending out an email blast to their members and had 2 links to PDF files on their website. Both files were uploaded into the media folder properly. No custom redirects or added protection for the 2 files. Nothing that I could initially find. So, I ran the typical tests:
- Deactivated all plugins – include mu-plugins – NO CHANGE.
- Changed to a default WordPress theme – NADA.
- Checked via cPanel to see if a directory was protected in any way – NEGATIVE.
- Cleared cache (duh) – STILL NO.
At this point, there was NO WAY this problem was going to beat me! So next, I tested OUTSIDE of WordPress to see if the trouble was WordPress or theme related at all. YEAH – I could get a direct link to that file to work.
Why on earth could I put a link on a page to a PDF and have it open no problem, but to copy the link location in the uploads folder would it only redirect me?
FINALLY THE ANSWER!
Permalinks. Yes, it was as simple as changing the permalink structure.
Step 1: SETTINGS > PERMALINKS > Click “Plain” (or the Default) > SAVE CHANGES.
Step 2: SETTINGS > PERMALINKS > Click back to the original setting (my preference is Post name) > SAVE CHANGES.
VOILA! Problem solved.
What is a PERMALINK you ask?
WordPress describes it as the permanent URLs to your individual pages, posts, categories, and other lists of weblog postings. A permalink is what a visitor will use to link to your a specific web page, post or article, or how you might send a link to your story in an e-mail message or on social media. URLs should be permanent, and never change — hence permalink.
My preference is Post-name because then I can create user-friendly and SEO specific URLs for each page of the website.
I hope this helps save someone else time because it took me a long time to finally think to check that one little setting.