Skip to main content
41 votes
Accepted

Magento 2 How can we get product url with product collection?

$productCollection = $productObj; Gives from product collection url using loop the collection, foreach($productCollection as $_product){ echo $_product->getProductUrl(); }
Rakesh Jesadiya's user avatar
9 votes
Accepted

Magento 2: Setting the product url key with REST API

Although Swagger doesn't specify "url_key", you can add this attribute value by the following method: { "product": { ... "customAttributes": [ { "attributeCode": "url_key", ...
PY Yick's user avatar
  • 2,705
6 votes

URL Key not changing in Magento 2

The issue resolved with below solution. As I said url_key was not regenerating only with Migrated Products from Magento 1 to Magento 2 with UB Migration Tool Lite Extension. At the time of Migrating ...
zubair's user avatar
  • 115
6 votes
Accepted

Export Product Sku and Product_Url in magento2

I got reference for the answer from this answer and I add addition part to show url_key column, please try this sql query : SELECT e.entity_id AS 'id', v1.value AS 'name', v0.value AS '...
mrfizh's user avatar
  • 1,363
4 votes

How to find duplicate URLs in the database?

To get the Product URL key duplicates. Please check the attached custom script in which the default store view code will be 0 and it will check all the products i.e enable, disable,is_salable, etc. If ...
Rajkumar Vellaiswamy's user avatar
3 votes

Magento 2 is generating the product url with catalog/product/view/id instead of product name

In case anyone else has this issue, I had the same and the above didn't work for me either. The issue is caused by duplicate url keys being generated from products with the same name. I used this ...
David's user avatar
  • 73
3 votes
Accepted

How can i bulk export Products like sku, products name, request path and Target path

you can export the id, sku, name and request & target paths with this sql: select e.entity_id, e.sku, ev.value as name, u.request_path, u.target_path from catalog_product_entity e inner join ...
Cristi's user avatar
  • 817
3 votes

M2: Is `url_path` used for anything?

url_path is deprecated, and could safely delete its data. I tested it in my Magento 2.3.2. You could see the deprecated statement in the offical github comment and the graphql-ce codes. url_path: ...
Key Shang's user avatar
  • 3,445
3 votes

Magento 2 get Product Url in Foreach

Use this code : => Using object manager : $product = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection') foreach($product as $_product){ echo $_product-&...
Rohan Hapani's user avatar
  • 17.5k
3 votes
Accepted

Magento 2: Issue with Product URL rewrite on Single Store Mode

After so much debugging, I've found an alternative solution for this issue by creating a custom module to generate the URL rewrite while creating/editing a product from Admin. Create Vendor/...
Sumit's user avatar
  • 4,968
3 votes

Magento 2 - add prefix before category and products urls

Please check below ways which are working solution to add a prefix before the category and products URLs https://magecomp.com/blog/how-to-add-prefix-to-store-products-urls-in-magento-2/ Magento 2 .2 - ...
CoderKube Technologies's user avatar
3 votes

301 Redirection from Old Magento2 URLs to SEO-Friendly URLs

You can create 301 redirection for catalog/product/view path url to seo friendly url by below approach. Step 1: You can override catalog/product/view controller execute method. Step 2: Then you check ...
Nikunj Rawat's user avatar
2 votes

M2: Is `url_path` used for anything?

"url_path" is used for url rewrites generation. Even in Magento 2.4.
Sergey Uskov's user avatar
2 votes

Get Product Url return 404

I hope this will help you. It works for me $products=Mage::getModel('catalog/product')->load($productid); return $products->getUrlModel()->getProductUrl($products);
Sameer Bhayani's user avatar
2 votes
Accepted

Add a static URL prefix for product and category Magento 2

I found a good solution for this situation! We need to make our custom module for extending Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator class with plugin methods and Magento\...
Mehran Zarei's user avatar
2 votes

Magento 2 Get Product Url For Specific Store

From the Magento2 root, you can run below code inside any custom php file. require './app/bootstrap.php'; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); $_objectManager = $...
Bhavin iFlair's user avatar
2 votes

Product url displaying category-ID and product-ID

Steps to configuration to remove the category-ID and product-ID Enable product url by categories in Stores > Configuration > Catalog > Catalog > Search Engine Optimization > Use Categories Path for ...
HIren Kadivar's user avatar
2 votes
Accepted

Why the Campaign Tracking Parameters isn't working on Product Pages?

In our case the issue was caused by the Creare SEO extension. Class::function: Creare_CreareSeoCore_Model_Observer::forceProductCanonical() Simply setting the creareseocore/defaultseo/...
ElGatito's user avatar
  • 890
2 votes
Accepted

Magento 2 .html.html issue after update from Configuration > Catalog

After do many research for this question and can't get any success. I have solved this issue to edit the Model file of /vendor/magento/module-catalog-url-rewrite/ module. I have overwrite the Catalog ...
mageDev0688's user avatar
2 votes

change the over all product url

You can use product sku value in product "URL Key" field. Or You can use an extension for custom product URL. Its free and easy to use. https://www.magentocommerce.com/magento-connect/catalog/...
Chandra Bhushan's user avatar
2 votes

Some products have catalog/product/view/id/2221/name-of-the-product from product URL magento 2?

Note: Please take a backup of the database To resolve this issue first delete the rows from the "url_rewrite" table which has 'product' as 'entity_type'. You can use below query DELETE FROM `...
Kishor Thummar's user avatar
2 votes

I WANT TO CREATE TWO URL'S FOR SAME PRODUCT FOR MAGENTO 2

Try this :- Open admin panel > Marketing > SEO & Search > URL Rewrites > Add URL Rewrites button Example:- select Create URL Rewrite -> For Product Request Path -> skuNo Target ...
Himanshu's user avatar
  • 978
2 votes
Accepted

Multiple URL Rewrites for the same product is SEO issue?

Multiple URLs explanation: Thanks to Kalvin Klien, as he mentioned in the comment. The Sitemap URLs are crawled by Google. By default the category path is not added in the product URL as the ...
Rajkumar Vellaiswamy's user avatar
1 vote

Some products have catalog/product/view/id/2221/name-of-the-product from product URL magento 2?

You can try/use Regenerate a Url rewrites extension. The extension allows you to regenerate a Url rewrites of products and categories. 1 > Run command to re-generate Url rewrites for all categories/...
Manish Bhojwani's user avatar
1 vote

Magento2: Remove Category path from product URL is not working

You must follow in your admin, Store -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -> Use Categories Path for Product URLs, you must change to No, and you have to ...
St3phan's user avatar
  • 2,927
1 vote
Accepted

Magento 2 : Product URL rewrite issue

I have fixed the issue by using this extension https://github.com/Iazel/magento2-regenurl Reference: https://magento2-blog.com/magento-2-regenerate-url-rewrites/
Jancy Abraham's user avatar
1 vote
Accepted

Magento 2.2.2 multillanguage url rewrite

In Admin -> Store -> All Stores, make sure the store view codes are set as English = en and French = fr. And in Admin -> Store -> Configuration -> General -> Web -> URL Options -> Add store ...
Lez's user avatar
  • 2,967
1 vote

Magento 1.9.2.1 Product Upload Via .csv file does not generate url rewrites

url_key is not a mandatory attribute. Magento will assume the product's name (with some preg_replace) if not specified. This means, if your product name is for example "Test Test" your initial url_key ...
Christoph Farnleitner's user avatar
1 vote

How to export product url in Magento2

You can use SQL for import. For example, in eav_attribute you can find attribute_id for product url_key. Default value is 126 Further, you may use this SQL: SELECT catalog_product_entity.entity_id,...
Anny's user avatar
  • 21
1 vote

Magento v1.9.x ultimate module creator entity URL rewrite / key problem

This module might help you https://github.com/vladsmirnov/url-rewrites. I have used it in one of my projects. It helped in reducing the duplicates while reindexing. Please run the shell script in the ...
Kalyan Chakravarthi V's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible