-1

I have a Drupal website. I've tested my site with speed sites like gtmetrix.com, and they advised to remove query strings (e.g. http://www.example.com/script/jquery.js?n) from my static content.

I also noticed that the "n" keeps changing sometimes to another character like "h" or something else.

Why do these query strings keep changing? Plus, is there anyway to stop having those query strings?

  • The query string changes on cache rebuilds to act as a cache buster for caching layers / the browser. – Kevin Sep 15 '17 at 19:26
0

This is part of Drupal's caching mechanism, it caches the css and js files that is why you get this query string. It is not recommended to remove this caching. But for development purpose we can disable it by adding the following in settings.php file,

if (!class_exists('DrupalFakeCache')) {
  $conf['cache_backends'][] = 'includes/cache-install.inc';
}
// Default to throwing away cache data
$conf['cache_default_class'] = 'DrupalFakeCache';

// Rely on the DB cache for form caching - otherwise forms fail.
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

For more info, from drupal.org

  • Thanks can i just disable Drupal caching and if so how? Another question is the query string keeps on changing why? – rocksusa Sep 15 '17 at 15:30
  • Please verify updated answer and quoting from drupal.org , " This will have performance detriments, of course, so must not be used in production.". – Kstack Sep 15 '17 at 16:58
  • It is not recommended to disable caching, outside of local development. – Kevin Sep 15 '17 at 19:26

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.