How to remove only sub category URL from magento - magento

I am using Magento for my eCommerce website
My current URL structure is :
example.com/parent-category/sub-category/page
I want a solution for the URL be changed to:
example.com/parent-category/page
I just want to remove sub category from the URL

We can configure it by URL Rewrites
Go to Magento 2 Admin -> Marketing -> SEO & Search -> URL Rewrites
Find the path by searching the Request path column.
Remove the cache PHP bin/magento cache:clean.
Refresh the front-end, click the main menu category then you can see the configured path.

Related

URL rewrites not working and keep changing the URL extension

I cannot get the URL rewrite in Magento to work correctly at all. I'm trying to redirect a category to a CMS page and at first try it works fine. After I refresh, it starts to change the URL extensions to something completely different than what's shown for the category URL. I've tried clearing the cache and reindexing the URL rewrite but that seems to change it again!
And if I do try to change the URL rewrite to this new, random, made up one that's being automatically inputted - it changes it again! I'm so confused here..
Fixing weird URL Rewrites
Sometimes when you make changes to your products, or enable a certain extension, Magento might start to rewrite all your URLs to include a suffix "-1" or some other number. Within the URL Rewrites, Magento differentiates between System URLs and Custom URLs. If the System URLs are broken like this, you should not fix this by adding new Custom URLs.
Instead, open up phpMyAdmin, create a backup of your Magento database, and flush the Magento table core_url_rewrite (so that it becomes totally empty). Immediately afterwards, refresh the Catalog Url Rewrites under Index Management. This will regenerate all System URLs.
You can also try to redirect through the .htaccess.
Redirect 301 /site-URL-to-redirect www.site.com/url-destination
There are two ways to redirect your category page to cms.
Using Magento native URL rewrite managment.
In Magento 1.x go to
admin -> catalog -> url rewrite managment -> add new url
select custom in Create URL Rewrite: drop down and then give your categoy url as request and cms page as target.
Using .htaccess file. Add this line of code into the file .htaccess:
Redirect category-url cms-page-url

how to redirect the URL in magento?

how to redirect the URL in Magento if i click on category or subcategory it should show page which i have created because of responsive design i'm doing this
I've created the URL for pages in such a way that the both category and subcategory URL is equal to page URL.
For this all you have to do is to add URL rewrite. For example if you category id is 10 and cms page link is "cmspage.html", then in magento backend admin go to
catalog->URLrewrite Management and search for id 10 in ID path column copy the "Target Path" field data now write a custom url rewrite for this "Target Path"
go to Catalog->URL rewrite Management, Click Add URL rewrite button. choose “Custom” from “Create URL Rewrite” drop-down list. add the details like belwo
Request Path — It must be the Target path which copied before (catalog/category/view/id/10) in above.
Target Path — It should be the CMS page URL
That's it you will have linked category with custom cms page

Magento 1.9 Navigation link to home page

How would I make a link from the main navigation to the home page (or any other page)?
I can do it in the Admin using
Catalog -> URL Rewrite Management -> Add URL Rewrite
Then creating a Custom Rewrite.
I use the hardcoded link to the homepage http:\\somedomain\magento as the Target Path and set it to Permanent 301 Redirect.
Then I delete the original System rewrite for the home category.
This works until it's reindexed, then the original System rewrite for that category comes back and the Custom one I created doesn't work anymore.
I found out what I was doing wrong. I shouldn't have deleted the original system rewrite. These are the steps to make custom links from the navigation menu.
1) Copy the Target Path from the System Category rewrite
2) Change the redirect to Permanent 301 for the System Category rewrite
3) Create a new Custom rewrite.
4) In the new Custom rewrite, paste the copy from #1 into Request Path
5) For ID Path put the URL Key for the page to be linked, for default page is /
6) For Target Path put the path to the new page (e.g / or /contacts)
This article explains it in detail : http://go.magento.com/support/kb/entry/name/adding-page-links-in-the-navigation-bar/

Magento - How to create a custom url based on attributes?

In the Magento Admin > Catalogue > Attributes > Attribute Sets, we have a set of attributes for "Manufacturers" which group products under designers.
I am trying to create a hyperlink that maps a custom route to an attribute query like so
this is route i want:
{{base_url}}/designers/some-designer-name/
this is what it will map to:
{{base_url}}/?designer=136
I have tried creating a custom url rewrite under Catalogue > URL Rewrite Management with no luck.
Please refer this this may help you
http://www.atwix.com/magento/products-list-cms/
if you want to create custom url, than follow the steps...
From the Admin panel, select Catalog >> URL Rewrite Management
In the upper-right corner, click the Add URL Rewrite button
In the Add New URL Rewrite section, set Create URL Rewrite to “for Product.”
Find the product in the list below and click to open the record and click Skip Category Selection button
In the URL Rewrite section, do some following things:
a.In the Request Path field, enter the new value for the updated URL. The Request Path must be unique for each rewrite.
b.Set Redirect to one of the following:
Temporary (302)
Permanent (301)
For your own reference, enter a brief description of the rewrite.
click to save and enjoy ;)

Magento migration from single store to multistore. Redirects

I have 1 website for now. Its URL is www.test.com, for example.
I want to create second website on the same domain adding store codes to URLs. So my URLs will be
www.test.com/first/
www.test.com/second/
But as I can see all my previous URLs will show 404 on their open. So if I open
www.test.com/product.html
it will show 404. It is not good because I loose my SEO.
How can I create redirects so if user opens
www.test.com/product.html
he will be automatically redirected to default website, like
www.test.com/first/product.html
Shall I have any issues with such redirects? (Like API will not work)
Or is it possible for URL
www.test.com/product.html
to show product from default website, if exists?
Magento has a very good system for SEO.
For Rewrite Management these are the steps:
1.Loginto Admin.
2.Move mouse over Catalog and you will find a drop down.
3 Select URL Rewrite management.
Catalog >> UrlRewrite Management
4.Then click on ADD URL Rewrite Button.
5.Then on next screen select custom from option provided
Create URL Rewrite : Select Custom
Now following important fields and values that should go:
Request Path (Old URL ) Target Path ( New URL ) redirect (Permanent 301).
Note : This approach will be good if you have few products but if you have too many product then some .htaccess rule is recommended.

Resources