Search code examples
urlmagentourl-rewritingmagento2

Where does Url rewrites go in Magento 2.4.2? (Programmatically)


right now I am learning Magento 2.4.2

I have created a page and the url for my page is: http://learningmagento.docker/pages/page/About

But I would like it to be: http://learningmagento.docker/creatuity/why-creatuity

While there are plenty of docs on how to do this programatically all the tutorials seem to be missing the same info. Is this a simple script file or a class? Where does this file belong?

Would anyone be able to answer these questions or provide the proper documentation?


Solution

  • Is this a simple script file or a class? Where does this file belong?

    It's neither a script file or a class. You create rewrites via the Magento 2 admin (usually under the Marketing section). The data for these rewrite objects is stored in the url_rewrite table.

    In addition to creating rewrites manually, many Magento features (products, CMS pages) will allow you to set a URL-ish field and Magento will create the data in the url_rewrite table for you.