We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Custom extension in url

Dear All,

I did not find any information on how to create custom extension url ini phalcon ?

for example :

http://ebmt.wm/api/PenerimaManfaatIndividu automatically translated to http://ebmt.wm/api/PenerimaManfaatIndividu.json

i'm newbie in mod_rewrite

Thank you for your help.

Kind Regards, Wildan

You could use Phalcons custom routes - http://docs.phalcon.io/en/latest/reference/routing.html#usage-examples

http://example.com/api/Something to http://example.com/api/Something.json

$router->add("/api/:controller\.json", array(
    'module'      => 'api',
    'controller'  => 1,
    'file'        => 2

Thanks, it works!