I want to redirect all product URLs without a category path to their category path URLs for SEO purposes.
Example - Redirect mywebsite.com/product-name.html to mywebsite.com/category1/sub-category/product-name.html.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
Please change your catalog configuration.
Admin -> Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -> Use Categories Path for Product URLs to NO
php bin/magento indexer:reindex
php bin/magento cache:clean