0

Recently selecting Aggregate and compress CSS files or Aggregate JavaScript files in the Performance page stopped working on a Drupal 7 site: When they are selected, the CSS/JavaScript file won't load.

I have cloned the site on another server and the problem doesn't occur there. The PHP version and the Drupal version (7.89) is the same.

How can I debug what is going on here?

Edit: Additional info

As I mentioned in the comments, the aggregated CSS files are not viewable in the browser. However, If I change the filename to e.g. test.css, it then is viewable.

Further:

Each aggregate file has a corresponding .gz of the same name. When I delete this the .css file is then viewable via the browser. So it looks like the issue has something to with these .gz files.

10
  • 1
    Typically this is due to a folder permission issue. Make sure the /sites/default/files folder has the correct folder owner and group besides having the appropriate chmod 755 permissions.
    – No Sssweat
    Commented Apr 7, 2022 at 9:41
  • 1
    What does "When they are selected, the CSS/JavaScript file won't load" actually mean? Are the files not generated on disk, or not referenced properly in the HTML?
    – mona lisa
    Commented Apr 25, 2022 at 14:17
  • 1
    How does the web server's configuration differ between the working site's and broken site's?
    – mona lisa
    Commented Apr 25, 2022 at 14:59
  • 1
    Also: they are empty? Is the HTTP response a 200 code?
    – mona lisa
    Commented Apr 25, 2022 at 15:01
  • 1
    Are the web server's configurations identical?
    – mona lisa
    Commented Apr 25, 2022 at 15:20

1 Answer 1

2

Well it turns out that mod_headers wasn't enabled on my server, which therefore meant that the '# Rules to correctly serve gzip compressed CSS and JS files' section within .htaccess didn't work.

It used to be fine, so it looks like the hosting company changed the Apache config recently 🙄

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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