REST API access

Hi there,

This is how users can access to REST API:


https://app.example.com/developers/v1/create/user/

I’d like something like this:


https://api.example.com/v1/create/user/

Here’s my .htaccess:


<IfModule mod_rewrite.c> 

  RewriteEngine on

  RewriteRule ^admin/(.*)$ backend/web/$1 [L]

  RewriteRule ^developers/(.*)$ api/web/$1 [L]

  RewriteRule ^(.*)$ frontend/web/$1 [L]

</IfModule>



I’ve created a new CNAME (api.example.com points on example.herokuapp.com) on Heroku, so they can access as the following:


https://api.example.com/developers/v1/create/user/

I’d like to remove this “developers”. Is there a way?

Yes. URL manager rules.

Ah, wait. You have your entry script in a sub-directory?

Thanks for the answer.

I’m using an advanced template with two folders:

[list=1]

[*]frontend

[*]backend

[/list]

And I’ve added api folder as well. I’ve totally forgotten about URL manager rules. I’ll check out what I can do with it.