1

What is the easiest way to

  1. change the /customer/account/login/ URL to /kupac/nalog/prijava/ but to preserve the functionality too?
  2. I will also need to change /product/id/X to proizvod/X where X can be arbitrary string or number.
  3. Lastly, I need to change URL: http://localhost/darnik/catalogsearch/result/?q=lajsna to this URL: http://localhost/darnik/katalog/pretrazi/?q=lajsna

2 Answers 2

3
+50

You can rewrite this core URL using config.xml of your module.

<global>
    <rewrite>
        <designer_url>
            <from><![CDATA[#^/kupac/nalog/prijava/#]]></from>
            <to><![CDATA[/customer/account/login/]]></to>
            <complete>1</complete>
        </designer_url>
    </rewrite>
</global>

UPDATE

<global>
    <rewrite>
        <custom_product>
            <from><![CDATA[#^/proizvod\/(.*)#]]></from>
            <to><![CDATA[/product/id/$1]]></to>
            <complete>1</complete>
        </custom_product>
    </rewrite>
</global>
7
  • 1
    Hi. This looks like it is working. Please see my original question, I edited it. I also need to change /product/id/X to proizvod/X where X can be arbitrary string or number. Do you also know how to do that? Commented Nov 23, 2017 at 10:21
  • 1
    please check the updated answer
    – Shyam
    Commented Nov 23, 2017 at 10:47
  • 1
    thanks! One more thing I need, and that is to translate the URL with querystring to a different URL, but with the same querystring added. Like this: Change this: localhost/darnik/catalogsearch/result/?q=lajsna to this: localhost/darnik/katalog/pretrazi/?q=lajsna Commented Nov 23, 2017 at 16:34
  • 1
    To translate routes for multiple stores, you can use this extension: github.com/klein0r/magento-language-routes. Configurations are pretty straight forward to translate a route using this extension as you see in this screenshot: prnt.sc/hebz01
    – Shyam
    Commented Nov 23, 2017 at 17:27
  • 1
    happy to hear that it worked for you
    – Shyam
    Commented Nov 24, 2017 at 11:24
1

If you are using magento 1.9 then this extension might help you.

You might want to look into this question too - Translate url keys when switching store

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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