My multi site Drupal 7 installation is suddenly unable to load any CSS file located in the /modules folder and subfolders (for example http://example.com/modules/system/system.base.css). I get "Failed to load resource: the server responded with a status of 403 (Forbidden)" in the browser console.

All CSS files for installed custom modules and all custom theme CSS files (inside /sites/all/modules and /sites/all/themes) are loading just fine.

Even more strange: the /modules/ CSS files load fine if I enable "Aggregate and compress CSS files." in Configuration > Development > Performance. When I disable "Aggregate..." I get the 403.

I realize that aggregating CSS is recommended in production sites, but I need to figure out what is going on and why the CSS files are not loading (they were loading fine earlier today). I did some changes in permissions earlier today, but I reverted those, with no success.

Any ideas?

PS: I noticed that Drupal adds "?obkukf" after .css - what is this, and does this have anything to do with the problem?

  • I hesitate to put this into the answers below, since I cannot explain what happened. I ended up re-installing Drupal (except /sites) and that fixed the problem. I would still appreciate any insight. – argiepiano Aug 8 '16 at 6:53
  • Is there any changes in the permission before that happen? – Gulok Aug 10 '16 at 1:32

That extra query string are used to control caching. That will change everytime the cached files expired.

As per Dave Reid:

It's to prevent browsers from caching those files when they change.

See these threads:

https://www.drupal.org/node/346711 https://stackoverflow.com/questions/11362261/appending-query-string-to-all-js-and-css-files-to-prevent-caching

  • Thank you very much for this explanation. It is helpful, but it doesn't answer the main question above of why suddenly I was getting 403 errors in different browsers. Sorry, I shouldn't have added the "PS" with a different question at the end of my question. My bad – argiepiano Aug 8 '16 at 13:59
  • Sorry, my bad. I will update my answer in a moment. – Gulok Aug 10 '16 at 1:30

This was likely due to a permissions issue on the module's directory (or a parent directory of the module's directory).

When you enable the setting for "Aggregate and compress CSS files" a new style sheet is created in the Drupal files directory (usually at sites/default/files), and the new file -- which contains a compressed copy of was in separate css files before -- is used in place of those separate files.

The Drupal files directory will have different permissions than the code. The Drupal files directory needs to be writable by the webserver, and the code should not be.

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.