I have a module built in magento 2.1.16 which store details of contacts in database and fetches them on list page and details view page. The contacts are of 3 types

  1. Branches (https://roadmaster.com.co/en_sa/contacts)
  2. Dealers (https://roadmaster.com.co/en_sa/dealers)
  3. Authorized Centers (https://roadmaster.com.co/en_sa/servicecenters)

When i clik on more information on any I get url like this one https://roadmaster.com.co/en_sa/dealers/view/index/id/24/ While i want something like https://roadmaster.com.co/en_sa/dealers/al-khaleej

or for this url https://roadmaster.com.co/en_sa/contacts/view/index/id/1/ I want something like https://roadmaster.com.co/en_sa/contacts/rm-jeddah

The contacts are stored in single table and are distinguished by contact_type attribute.


2 Answers 2


Do below steps Go to Url Rewrite from marketing menu

Now add url rewrite

Click on add url rewrite button

Now do as below and save it.

Set User Freindly Url

By this process you will get user freindly url as you want.


  • Thank you but i don't want this to do manually. I want it automatically (based on url-key) like magento has it for products and categories.
    – Abid Malik
    May 12, 2019 at 7:46

If you don't want to do everything manually under Marketing -> Url Rewrites

Then you should do something like:

  1. In Module that process /contacts/view/index/id/1/ add new field(attribute) for new seo friendly url, like magento do this for ex. CMS Pages enter image description here

  2. When you save this entity, pick up data from the field created in [Step 1] and create record in url rewrite table programmatically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.