6

Not my first time to install Magento 2, but something strange this time. I have checked file permission, cleaned cache, deployed again. Files are created in pub/static in expected directories but checking browser console I see there is "version###" subdirectory in path. How this is happening?

enter image description here

Zinat
  • 2,069
  • 2
  • 28
  • 52

5 Answers5

18

We can disable it in Admin:

Stores > Configuration > Advanced > Developer > Sign Static Files

Or we can change directly the value in core_config_data:

insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0); 
Khoa TruongDinh
  • 32,054
  • 11
  • 88
  • 155
6

Run the following commands and you will see static version number in the static URLs (CSS, JS etc.)

bin/magento config:set dev/static/sign 1

bin/magento cache:clean

bin/magento cache:flush

Hope it helps :)

Gagan Nayyar
  • 200
  • 5
  • 9
1

1)Run SQL query on DB (to disable Sign Static Files)

insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0); 

2)After That clean and Flush Magento Cache

bin/magento cache:clean
bin/magento cache:flush

And Refresh the page

Anil Pawar
  • 31
  • 2
0

Follow this link and go to the line

https://www.simicart.com/blog/how-to-install-magento-2-localhost/

Additional tweaks for Magento 2.4.2 and above

you may get error in css and js path then you run

sudo rm -rf pub/static
sudo rm -rf var/cache
sudo rm -rf var/composer_home
sudo rm -rf var/generation
sudo rm -rf var/page_cache
sudo rm -rf var/view_preprocessed

and run

sudo php bin/magento setup:static-content:deploy -f

and run

php bin/magento cache:flush 

Done.

0

Happened to me few times. so I'll add another one to check

All of the above and make sure you have .htaccess in your pub/static folder

Nuwinda
  • 31
  • 3