cancel
Showing results for 
Search instead for 
Did you mean: 

How to translate url keys in magento2

SOLVED

How to translate url keys in magento2

Hello All,

 

Hope all of you are doing well. Can anyone help me to translate the urls for customers and checkout.

Eg : domian.com/customer/address/index  => domain.com/customurl
       domain.com/customer/account/createpassword => domain.com/customurl
       domain.com/customer/account/forgotpassword => domain.com/customurl
      domain.com/checkout#shiiping => domain.com/customurl#customhash
Like these I have to translate some other urls also. I tried with url rewries in admin side. But I think that will not work for all my cases.
Eg : domain.com/checkout/onepage/success

Any help is really appreciated.

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to translate url keys in magento2

@sayanth_k 

 

Yes ! it is possible once you create Url-rewrite like above you'll be able to use the pages with the new URL but it will take extra coding efforts as I share you've to change the URL which is generating on frontend or the URL redirecting in controller (For example order success : you've to change the URL with your new url in code as well).

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

View solution in original post

5 REPLIES 5

Re: How to translate url keys in magento2

Hi @sayanth_k 

Kindly refer below link for lean URL rewrite functionality with Magento2:
https://magecomp.com/blog/magento-2-url-rewrite/

It may help you.
If issue resolve, please click on 'Kudos' & Accept as Solution!

Problem solved? Click Accept as Solution!

Re: How to translate url keys in magento2

For eg:

domain.com/checkout/onepage/success => domain.com/translatedurl

How can I do this with rewrite module ?

Re: How to translate url keys in magento2

Hi   

As per my understanding, you want to make alias for the given pages but the URL have to remain same as it picks the data from the URL domain.com/{route}/{controller-name}/{action}

but this is now possible for three areas :

[Product Page, Category Page, CMS Page]


But I tried one way which would also need code customisation, I created new URL for my cart page by following way :

  • Navigate in admin to :
Marketing > URL Rewrites (Under SEO & Search) > Add URL rewrite
  • Add the below details
    Create URL Rewrite : Custom
    Store : [Select the store for which you want to add URL rewrite]
    Request path : custom-url
    Target Path : checkout/cart/
    Redirect type : No
  • Then run below commands :
php bin/magento indexer:reindex
php bin/magento c:f
  • Now go to cart page where URL must be generating like this domain.com/checkout/cart/ and change URL with domain.com/custom-url
  • Now same page will open but with different URL

    Note : If you want it to automatically get it into URL when you open cart, then you've to change Go to Cart button action url of mini-cart or from wherever you're loading the cart page

@sayanth_k

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: How to translate url keys in magento2

@gaurav_harsh1Yes, this what I am looking for, but is it possible to change the below urls ?

domain.com/checkout/onepage/success => domain.com/translatedurl

domain.com/customer/account/createpassword => domain.com/translatedurl

These are generated inside magento, how can I change these

 

Thank you

Re: How to translate url keys in magento2

@sayanth_k 

 

Yes ! it is possible once you create Url-rewrite like above you'll be able to use the pages with the new URL but it will take extra coding efforts as I share you've to change the URL which is generating on frontend or the URL redirecting in controller (For example order success : you've to change the URL with your new url in code as well).

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy