cancel
Showing results for 
Search instead for 
Did you mean: 

Pretty Url´s

SOLVED

Pretty Url´s

Hello,

 

I´m not sure if just URL Key is the solution?

 

When I open a product in my store, then this url is in the address bar:

https://www.company.com/catalog/product/view/id/3653/s/4811/category/4/

But I want:

https://www.company.com/categoryname/productname.html

 

How can I made this?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Pretty Url´s

Strange...
Last option that we can try is regenerate all url using following module.
https://github.com/elgentos/regenerate-catalog-urls

But take full backup of table "url_rewrite" before re-write.

View solution in original post

13 REPLIES 13

Re: Pretty Url´s

Hi @hanhoe,

 

SEO url is already default feature in magento. 

Are you facing this issue specific block or in whole magento on frontend?

BTW you can add category url in with the product url using below magento setting. 

Admin -> Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -> "Use Categories Path for Product URLs" set to "Yes"

Do the re-indexing once using following command.

php bin/magento indexer:reindex
php bin/magento cache:flush

I hope it will help you!

Re: Pretty Url´s

Hello,

 

"Use Categories Path for Product URLs" is "Yes"

Reindexing and tried again. Same result.

When I open the category in store, then I have:

https://www.company.com/holzschutz1.html : OK

 

But when I open after a product, I have:

https://www.company.com/catalog/product/view/id/3653/s/4811/category/4/

Re: Pretty Url´s

I see now:

 

when I open

category => sub category => product ... it will work

but when I use

category => product ... it will not work

 

Re: Pretty Url´s

Did you migrated data from Magento 1 to magento 2? Because we face some similar issues in that case. 

Could you save again the category from admin panel after changing some url key for test only for which category you are facing issue?

Re: Pretty Url´s

Thanks!

 

It happen on all sites, which has a sub category.

I saved again one category but still the same.

 

When I open the product from their category it works. But when I open the category from the parent category (in parent category view, he display all products) I have the problem.

 

The Option "Create Permanent Redirect for URLs if URL Key Changed" is set to yes .... this is correct?

 

Or is it a .htaccess issue?

 

Re: Pretty Url´s

Hi @hanhoe,


The Option "Create Permanent Redirect for URLs if URL Key Changed" is set to yes .... this is correct. YES, this is correct.

This is also not looks like .htacess issue.

It looks like that there are not any seo url generated for these category.
Please verify once on admin.
Admin->Marketing->URL Rewite.

Search in target path and check if you have Request path for the same.

BTW which magento version you are using?
Otherwise you can generate SEO url again using following module.
https://github.com/elgentos/regenerate-catalog-urls

Re: Pretty Url´s

You can also try one more thing:

Admin -> Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -> Product URL Suffix = "" //CHANGE IT

Admin -> Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -> Category URL Suffix = "" //CHANGE IT

seo.png

Cache Clear and indexing and check.

It will also regenerate SEO url.

If it works then you can revert changes again.

Re: Pretty Url´s

Hi @Vimal Kumar 

 

IN Admin->Marketing->URL Rewites:

the url of the product is 4811 and when I search for 4811 I get:

maincategory/subcategory/4811.html

4811.html

 

When I open the product, while I'm in "maincategory" then its not working.
When I open the product, while I´m in the "subcategory" it will be working

 

I´m using 2.2.2

Re: Pretty Url´s

Hello,

 

I changed from .html to .htmll and the pages will get with .htmll ... but the problem is still the same. From the main category its not working.