Get Product URL Rewrites data by GraphQL Magento 2.

Using GraphQL Magento, We can retrieve the product URL rewrites data in the response. If the specific product has multiple URL rewrite histories, The response will be multiple arrays with all the possible URL rewrite for a product.

You can create a query by SKU or Search by product name for GraphQL, Continue reading “Get Product URL Rewrites data by GraphQL Magento 2.”

GraphQL Route query to fetch 301 redirect URL data in Magento 2.

GraphQL Route Query is used to fetch URL-related data for entity-type products, categories, or CMS pages. This query will be helpful while you are using PWA stuff to render proper pages based on the older 301 redirect URL.

If you have modified any URL for 301 permanent redirects and your e-commerce app running on PWA, while a user comes to your site and tries to hit the older URL, it will be going to 404 pages because the older URL has been permanently redirected to a new URL.

urlResolver() query is deprecated so try to avoid that query and use the latest route() Query for future proof your system. Continue reading “GraphQL Route query to fetch 301 redirect URL data in Magento 2.”

How to get Default No Route URL Programmatically Magento 2?

Get No Route URL Programmatically Magento 2 to redirect to 404 Not found page.

You can redirect to the No Route page using ScopeConfigInterface and UrlInterface to not found action. The default value for the No Route page is the cms/noroute/index. Continue reading “How to get Default No Route URL Programmatically Magento 2?”