Skip to main content
35 votes

How to delete and regenerate URL rewrites in Magento 2?

You can use Regenerate a Url rewrites extension (it allow to regenerate a Url rewrites of products and categories) . To re-generate all Url rewrites of the categories/products in all stores (it ...
Oleg Koval's user avatar
27 votes

How to delete and regenerate URL rewrites in Magento 2?

This module is been deprecated you can use this module instead Download Using Composer; composer require elgentos/regenerate-catalog-urls php bin/magento setup:upgrade Regenerate url for all ...
Mahendra Jella's user avatar
16 votes

Magento 2 {{store url="tipps"}} trailing slash and redirect

you need to use store direct_url for that. e.g <a href="{{store direct_url='tipps'}}">Test</a>
Sunil Patel's user avatar
  • 2,117
13 votes

How to delete and regenerate URL rewrites in Magento 2?

There is actually an easy way to fix this without a lot of trouble. For the TL:DR people, the bold parts are relevant. One thing to check first; if you have multiple store views, go into the product ...
Brokentusk's user avatar
12 votes

Magento 2: How can I remove all products URL rewrites?

To remove all URL rewrites related to the products, you can use that script SQL below. DELETE FROM url_rewrite WHERE entity_type='product'; If you want just to remove the URL rewrites that were ...
Rafael Corrêa Gomes's user avatar
8 votes

Lock wait timeout exceeded

The error is because the transaction is reaching its timeout period. If you did not set this in your my.cnf the default is 50 seconds I would highly recommend you look at your sever settings to ensure ...
SR_Magento's user avatar
  • 5,219
8 votes

Magento 2 .2 - How to add Static Product Prefix to Product Url?

After debugging of couple of hours i have resolved this issue by following below method. I have override two files in my custom module, One is Product Url Model and Another one is Router Controller\...
Manthan Dave's user avatar
  • 9,856
7 votes

How do you generate URL rewrites in Magento 2

I currently use this to update the url keys of certain products: Update 'url_key' attribute through Magento Import Admin --> Products Catalog --> Select the products you imported the new url_key for -...
Noewt's user avatar
  • 79
6 votes

Magento core_url_rewrite table excessively large

Since this is not yet mentioned in this thread, I wanted to share the cool news that this issue is fixed in Magento and later. See the related release notes: Magento no longer performs ...
Simon's user avatar
  • 5,736
6 votes

Magento 2 : get rewrite product url

Here is the method I used to get the product url. It is definitely not optimal as I have to load the entire product to get it so very bad in terms of performance. First you need to inject a Magento\...
Raphael at Digital Pianism's user avatar
6 votes

Magento 2 Category url rewrite is not working

Download "Regenerate Url rewrites" extension from here : Follow the below steps MANUAL INSTALLATION Extract files from an archive ...
Saneer Ladani's user avatar
6 votes

How to block cpanel link of my magento site

First thing you need to understand is that: for a webserver, both the owner and normal site visitors are the same. There is no default mechanism to identify a "Site owner". To achieve your goals, you ...
Nidheesh's user avatar
  • 1,048
6 votes

Magento 2: Bulk 301 rewrite imports

If you can load your CSV file content then This is the way to import Bulk URL Rewrite: Add below Code into script than run it. // MAGENTO START include('../../../app/bootstrap.php'); use ...
Ronak Chauhan's user avatar
6 votes

Unable to access magento without /index.php/ in the URL

Your problem is with .htaccess file. Take the .htaccess file from this git repo and put that file inside your Magento root directory Git Repo. Put this piece of code inside the .htaccess file. ...
Asheem Patro's user avatar
  • 1,070
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

How to remove trailing slash from Magento 2 url

Magento admin you can use store direct_url for remove trailing slash. example: <a href="{{store direct_url='contact-us'}}">Contact</a>
Savan Patel's user avatar
  • 2,366
6 votes

How to find if target path in custom url rewrite exists in magento 2

protected $_urlRewrite; public function __construct( \Magento\UrlRewrite\Model\UrlRewrite $urlRewrite ) { $this->_urlRewrite = $urlRewrite; } $UrlRewriteCollection=$this->...
Dipak Bhambhani's user avatar
6 votes

Magento2: Remove home after base url

You can do it using htaccess file . In htacess file find: Options +FollowSymLinks RewriteEngine on Then Put the below code in htaccess file RewriteCond %{THE_REQUEST} ^.*/home RewriteRule ^(.*)...
surbhi agr's user avatar
6 votes

Magento 2 - Get URL data by request path

After some digging in magento core code I finally got solution. I have used this code to get url_rewrite data by url key /* Find url data by request path */ $filterData = [ UrlRewrite:...
Shoaib Munir's user avatar
  • 9,512
5 votes

How do you generate URL rewrites in Magento 2

You can use Regenerate a Url rewrites extension (it allow to generate/regenerate a Url rewrites of products and categories) . To re-generate all Url rewrites of the categories/products in all stores (...
Oleg Koval's user avatar
5 votes

Getting 404 Not Found Error on every page except index.php

the solution for 404 errors on magento 1.9 was to 1-reindex data and 2-flush cache storage
dsk's user avatar
  • 51
5 votes

How to remove parent category from subcategory URL?

If you look at the class Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator which is responsible for the category URL rewrite generation, you will see that it uses a constant value to determine ...
Fabian Schmengler's user avatar
5 votes

Magento2 Product Page 404 Error Caused by URL Rewrite Not Working As it Should

I've worked out how to fix this for our particular situation. It was a corrupt database table issue. So error from system.log file relevant is below: main.CRITICAL: PDOException: SQLSTATE[23000]: ...
MagentoMac's user avatar
  • 1,042
5 votes

Magento 2 : Unique constraint violation found when adding product, categories or mega menu items

Solved in Magento 2.4.3! For me the problem was that the afterReplace function in Magento\CatalogUrlRewrite\Model\Category\Plugin\Storage added duplicate url rewrites to the ...
Henry Timmerman's user avatar
5 votes

Magento 2 custom url rewrite ignores query string

Magento 2 reads parameters in the following format: somepage/param/param_value/ It ignores the question mark. In your situation you have 2 options to go: 1) Manage this by using the rewrite rules of ...
Nikita Abrashnev's user avatar
5 votes

Re-direct Category Menu item to different URL

You can do this by adding a record in URL Rewrites In admin goto Marketing -> URL Rewrites add new URL rewrite by clicking Add URL Rewrite Create URL Rewrite Dropdown Select Custom Store Select ...
Rakesh Varma's user avatar
  • 2,226
4 votes

Case Sensitive URL Rewrites

Dan Hanly's approach is correct, but he failed to give the actual answer. Running this code in phpMyAdmin or other MySQL management utility will solve the issue: ALTER TABLE core_url_rewrite MODIFY ...
Michael Yaeger's user avatar
4 votes

How to redirect a category page link to CMS page link in Magento 2

Seems that you created a wrong url rewrite. "Request path" is the path that you actually see in your browser's address bar. So in your case it should be type.html instead of "catalog/category/view/id/...
MagestyApps's user avatar
4 votes

Remove Multiple Product URL Rewrites

You have to rewrite Mage_Catalog_Model_Resource_Url. In your config.xml: <models> <catalog_resource> <rewrite> <url>...
Pawel's user avatar
  • 1,096
4 votes

how to show product id included in url on product listing page?

Magento add URL-rewrite for product here: Magento\CatalogUrlRewrite\Observer\ProductProcessUrlRewriteSavingObserver In your extension you should add "before" plugin for execute method. See magento ...
sergei.sss's user avatar
  • 1,179

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