1

I have a problem whereby any files uploaded into the private directory cannot be viewed - returning a 404 not found error. The images upload ok and get placed in sites/default/files/private directory. The image path when trying to view is in the form /system/files/image.jpg which I believe is correct.

Firstly I found that there are conflicts with the Fast 404 module. Disabling this module makes the private files now work on my staging server, but not on our live server.

Could there be any server-side settings that could be affecting this?

What else should I be checking?

  • go to admin/config/media/file-system and check your private file system path . – WaQaR Ali Sep 11 '15 at 5:56
  • While going to live, you may further have to check certain permission applied on directory and files system. – WaQaR Ali Sep 11 '15 at 5:59
  • May be there's some permission issue. Try using chmod -R 777 /sites/defaults/files. If your private directory don't have sufficient write conditions, it will give you an error "file not found." – Sugandh Khanna Sep 11 '15 at 6:57
2

Merely disabling the Fast 404 module isn't enough if you are calling fast_404_ext_check(); in settings.php. Be sure you've removed the Fast 404-related settings from settings.php.

Due to the way private files are implemented in Drupal, you will never be able to use private files with the extension-checking features of Fast 404.

  • With the settings removed I get a white screen instead of a 404 now. Trying to access an image which actually doesn't exist returns a 404 as it should. Almost there... Any ideas? Strange how the staging site worked when I simply disabled the fast 404 module, but the live didn't. – Chris Sep 11 '15 at 6:19
  • Check your logs to see why you're getting a white screen. There are many possible causes for that. – Aaron Sep 11 '15 at 6:22
  • It seems it's only happening for one particaular (large) image. Might be a memory problem? Anyway - thanks for your help :) – Chris Sep 11 '15 at 6:23
0

If you are using the Fast 404 Module this can be solved by adding the path system/files to the

Array of whitelisted URL fragment strings that conflict with fast_404.

in your settings.php fast 404 section. $conf['fast_404_string_whitelisting'] = array('cdn/farfuture', '/advagg_', 'structure/menu/item/', '/flag','group/','/taxonomy/term/','media/', 'system/files')

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.