Magento 2 offers a feature of static content signing to invalidate the browser cache for static resources. To do so, it adds a deployment version to the URL of the static files.
However, these files’ URLs contain the deployed version due to which 404 error occurs.
The solution is to remove version number in file paths in Magento 2 and there are two methods given below for the same.
Methods to Remove Version Number In File Paths in Magento 2:
Method 1: From Admin Panel
- Login to admin panel
- Go to Stores > Configuration
- Under Advanced, select Developer
- Expand Static Files Settings
- Set “No” to Sign Static Files
Method 2: Run the below commands
insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
php bin/magento cache:clean
Use the Comments section below to mention any doubts on the topic and I’d be happy to help.
Feel free to share the solution with fellow developers via social media.
Get Weekly Updates
Never miss Magento tips, tricks, tutorials, and news.
Thank you for subscribing.
Something went wrong.