0
<route url="/V1/api/orders/:id" method="GET">
        <service class="Lovat\Api\Api\OrdersRepositoryInterface"
                 method="get"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route>

i create an API, and everything works well, but i i would like to change url API now URL looks like that http://localhost/rest/all/V1/api/orders/2

how can i edit url to http://localhost/api/V1/orders/2

1 Answer 1

0

I think the easiest way will be to create a rewrite rule and let it do the job. Refer to this lijnk for creating a rule in Apache - https://httpd.apache.org/docs/trunk/rewrite/remapping.html

If using Nginx then you can also search for it about how to rewrite the url. This way you don't have to change much of the code.

3
  • how is it possible to implement this with code? Commented Jul 23, 2020 at 12:14
  • Your server is running on nginx or apache? Accordingly the answer will vary
    – Arif Ahmad
    Commented Jul 23, 2020 at 12:17
  • I am writing a plugin that will install on Magento and I need to solve this problem with code if possible Commented Jul 23, 2020 at 12:21

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.