In Magento, you can hide product attribute values in the URL by modifying the configuration settings for the product URL key. Here are the steps to hide product attribute values in the URL:
Log in to the Magento admin panel and go to “Stores” > “Settings” > “Configuration”
Under “Catalog,” select “Catalog”
Under “Search Engine Optimizations,” change the “Use Categories Path for Product URLs” setting to “No”
Click on “Save Config”
By setting “Use Categories Path for Product URLs” to “No,” Magento will only use the product name as part of the URL, rather than including attribute values as well. This will make the URLs shorter and more user-friendly.
Another alternative way to achieve this is to create custom URL rewrites for your products, this can be done by going to “Marketing” > “URL Rewrites” in the Magento admin. You can then create custom URL rewrites that do not include attribute values in the URL.
It’s important to note that this change may affect your SEO, as it may not include the keywords that you want to target in the URL. However, this is a trade-off you may want to consider, as it can make the URLs more user-friendly.
It’s important to test the product URLs after making this change to ensure they continue to function correctly.