How To Remove Version Number In File Paths in Magento 2
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
1 |
insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0); |
1 2 3 |
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.
Thanks.
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
Prev
How To Use Dependency Multiple Field In Magento 2 Admin Form
How To Create Simple Products in Magento 2
Next