I am trying to give a custom url to categories in order to shorten the URL but have several issues. My problem is we have multiple levels of categories but one level was just created so that the navigation menu visually has a heading above a group of categories but we don't want that category to appear in the url path. For example, this category URL is similar to https://example.com/category1/category2/category3.html but we would like it to be https://example.com/category1/category3.html. I was able to change it using the catalog url rewrites in admin but when urls are reindexed it loses this value. Also, the canonical url is still the original that Magento created. Is there a way to achieve this? My SEO thinks the shorter URL is much better.
You can manually add the record in a catalog -> URL Rewrite Management from your Magento store backend.
Where you need to add request path as well as the targeted path both.
And you are done.
Well, changing of original URL is not possible for this one because whenever reindexing happens it will automatically revert the URL & even you cant change it manually from the database.
So, its compulsory to use 301 redirects for URL.