I have CakePHP 2 installed on my Apache 2 web server.
I would like to make an API for my web app and instead of accessing it through “https://www.server.com/api/…”, accessing it through “https://api.server.com/…”.
I really don’t know how to make it work. I tried to enable a new apache site but I can only redirect to a real location on the server while I want to redirect to the “api” controller which don’t really have a location on the server.
I don’t know if I’m realy clear, so if you need more details, ask me.
Thanks in advance!
Sébastien
You can add a new record (CNAME) in dns zone: api.server.com to http://www.server.com
After you do this change, when you enter on api.server.com will be loaded http://www.server.com.
In your controller you can detect the hostname.