Hello,
Magento 2.0.4 Url rewrite not working ?
How to remove all already placed custom url and re-create them is there same way like magento 1. I have get table url_rewrite which is may be working same way to core_url_write magento 1 table ?
but if we truncate this table its automatic created by system ? because after truncated this table its not recreated and magento2 product and category page url structure has been changed like below for product
http://{domain}/catalog/product/view/id/1/s/joust-duffle-bag/category/4/
Is there any way we can resolve this issue ?
there are many thread available which is reflected that magneto 2 url rewrite is not working, is there any perfect solution ?
this problem face after migration of project if it has custom url-key and .html extension is removed from product page & category page
@magento-team
Thanks
@Yogesh7989 Can you explain step by step how to reproduce this issue?
Hello ,
@piotrekkaminski We have done following step,
I have installed magento 2.0.5 with sample database. i want to regenerate or update url key for all products as well category. i used method same as magento 1. truncate table of url_rewrite which is used in magento 2, after truncate this table magento is not generated url key path for products as well category. its gives system url like
http://{domain}/catalog/product/view/id/1/s/joust-duffle-bag/category/4/
Magento 2 remove core url rewrite from index management and generate run time but how it works ? we are not able to find that solution.
Why we need to do above things.
we have face issue in url rewrite mapping after migration from M1 version 1.7.0.2 & 1.9.2.2 to M2 version 2.0.2 & 2.0.4 & 2.0.5 , we have use migration tool 2.0.5 & 2.0.2 & done migration by CMD.
custom url is not working for all products & categories pages and its giving 404 error. we are not able to resolve that so we have try to regenerated it , truncate table url_rewrite and face problem same as above magento fresh installation.
Please let me know if you need more clarification.
Thanks
Hi there,
same here. Our Urls when migrating from 1.7.0.2 to M2 2.0.2-5 are completely messed up.
Truncating the url_rewrite table in M2 then leads to system urls mentioned above.
So how can we regenerate this table to regenerate the new urls which are placed right in the categories in the backend by the way?
Hi,
I got the same issue, but my reason for truncating the url_rewrite table is that we met some issue on product import and truncated the table was a working way to solve it.
Hi ,
@piotrekkaminski is there any solution for this issue?
Thanks
Hi all,
Thanks for raising the question.
There's no such feature in M2 as it was in M1. I've created internal ticket MAGETWO-52878 to process the issue.
Thanks,
Kateryna.
Thanks @katmoon .
Hi @Yogesh7989
That ability to auto-generate URL rewrites as in M1 is not planned for M2. That is it's better not to truncate url_rewrites table.
Which tool did you use for migration? It is the problem of the tool that it did not migrate url rewrites correctly.
Thanks,
Kateryna.
@katmoon
Many thanks four your answer.
We also have the same problem and using official data migration tool.
But there are also other cases where the urls need to be regenerated. For example we wrote a module to flatten the category urls (no main category in the subcategory url). This is a normal step for a lot of shops to have a url structure which is flat. The problem here is that in the backend there is no such setting and so you have to write a own module. And here is the problem again. The module can only affect new categories created - the old categories stay the same like before. And this is the problem:
There is no way to regenerate the URL without the option to truncate the url_rewrite table at all. Or is there any?
So we face two problems regarding this:
Both keep us away from migrating to M2 at the moment which is really worst case to us.
Hello @katmoon ,
I have mention in above post.
we have face issue in url rewrite mapping after migration from M1 version 1.7.0.2 & 1.9.2.2 to M2 version 2.0.2 & 2.0.4 & 2.0.5 , we have use migration tool 2.0.5 & 2.0.2 & done migration by CMD.
Thanks
Yogesh
Hello ,
@katmoon , @ilol , @piotrekkaminski , @maksek , @yaronish
Is there any solution for this issue we stuck this level in migration.
Thanks
Hello ,
I have Find solution in this way.
First check your affected rows with select query in url_rewrite
SELECT
request_path,
SUBSTRING(request_path, 1, CHAR_LENGTH(request_path) - 1) AS col_trimmed
FROM url_rewrite
WHERE request_path LIKE '%/'
Update affected row
UPDATE url_rewrite SET request_path = SUBSTRING(request_path, 1, CHAR_LENGTH(request_path) - 1) WHERE request_path LIKE '%/'
it is working fine for me.
@Yogesh7989 Thanks! Your solution works great!
@Yogesh7989 I have imported my URLS from woo-commerce store into url_rewrite table on Magento 2.1v, the thing is all woo commerce store links have ?= parameters. Magento 2.1 does not redirect custom url with parameters ?, Is there any temporary solution?. Issue
I developed a CLI command for this purposes, as a work around
@Yogesh7989 Can you explain me how to execute your solution.
I am not an expert. Are they mysql commands?
Internal issue was closed as not a bug with a comment from PO that we don't want to have a separate indexer for URL rewrites in M2.
If you think such improvement should be done please submit it to Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here)
@agentgod did you have find a solution?
Thanks @Yogesh7989 . Works perfect
Most helpful comment
Hello ,
I have Find solution in this way.
First check your affected rows with select query in url_rewrite
SELECT
request_path,
SUBSTRING(request_path, 1, CHAR_LENGTH(request_path) - 1) AS col_trimmed
FROM url_rewrite
WHERE request_path LIKE '%/'
Update affected row
UPDATE
url_rewriteSETrequest_path= SUBSTRING(request_path, 1, CHAR_LENGTH(request_path) - 1) WHERE request_path LIKE '%/'it is working fine for me.