I am currently running WordPress/Woocommerce on an Apache server.

I have files for sale on the server, located outside of the public path for security.

I am attempting to link the downloadable files using file:///srv/protected/book1.pdf, but the site is serving a unique URL path (as expected) but returning this page is not available.

Any ideas why these remote server files are not downloading?

The "protected" directory is owned by Apache and within the Apache group. The files within the "protected" directory are owned by their uploaders, but also within the Apache group.


A url linking to file:/// will try to access that file on the user's PC, not the server.

You must link to the file directly through the filesystem as your server allows, whether that be with a relative path ../../srv/protected/book1.pdf or absolute /srv/protected/book1.pdf

Make sure your DOCUMENT_ROOT in Apache is setup in a way that will allow these directories to be accessed (sym links or the data residing inside of the root).

  • The Symbolic Link worked to perfection. Thank you! – Ryan Prentiss Jul 5 '14 at 7:22
  • Quick follow-up... how would I prevent direct linking to the files via the symlink, as a paranoid protective measure? – Ryan Prentiss Jul 5 '14 at 7:25
  • Set the permissions to restrict only owners and groups to have access - chmod 750 [filename] should do nicely. – Deryck Jul 5 '14 at 7:33
  • Hey @Deryck, I set permissions on the files to 640, but set able to access the files directly. – Ryan Prentiss Jul 6 '14 at 1:39
  • sounds great glad it worked out. I use 750 just for my own kicks to live on the edge. 640 is the right way to go lol – Deryck Jul 6 '14 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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