• Resolved j w

    (@justinmwoodum)


    Hello. I have some links that are displayed in WordPress posts. These links lead to content (PDF files) that are outside (above) the WordPress directory.

    • [root]/WordPress/
    • [root]/OutsideFiles/test.pdf

    When the links are used, the proper URL appears for a moment in the browser, but then the user is redirected to the WordPress homepage. How can I make these links work? Thank you.

    P.S. While there are many discussions on similar topics, I have exhausted my search and none of the ideas I have found have worked.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Are you using absolute url paths? Ex: https://website.com/fileOutSide

    Thread Starter j w

    (@justinmwoodum)

    Yes.

    I would check the htaccess file. https://codex.www.ads-software.com/Using_Permalinks

    Thread Starter j w

    (@justinmwoodum)

    Thanks, graphical_force. I read through the link you shared but didn’t find any solutions.

    FYI, after many hours of trying different approaches, I have come to the conclusion that linking to files outside of the WordPress directory like this goes against “the WordPress way”, which is why it’s so much work. Certain WordPress architectural decisions have been made (seeminly for the sake of security & SEO) that try to prevent this. Rather than break things to force this to work, I am bringing these external documents (PDF files) into WordPress via the Media Manager and sharing the files via the WordPress location instead. UX-wise, the user will not see a difference. To keep any old links to the PDFs from breaking, the PDFs will need to either also remain at the old location (so, two copies total: one set at old, one set in WordPress) or, if the old location is made inaccessible/deleted, redirects will need to be added to the .htaccess file to handle incoming requests. Just thought I’d share.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Link to file outside WordPress directory’ is closed to new replies.