jeudi 29 octobre 2015

Sub-domain routing in Laravel on shared hosting

I'm using Laravel framework version 5.1 for my web application that will be run on a shared hosting. Since I have a very limited access to this host, (e.g. I don't have a SSH access, can't create virtual hosts inside the machine etc.) I had to make some tricks to run it smoothly. Here is what I've done so far:

  1. Moved the files inside of the public/ directory to my root directory.
  2. Changed the file paths of auto load registrar in the public/index.php with the new directory.

Everything works as intended except the sub-domain routing. I defined api.myapp.com as wildcard on routes.php but when I try to visit this subdomain, Chrome gives me DNS_PROBE_FINISHED_NXDOMAIN error. Here is the code from routes.php:

Route::group([
    'domain'     => 'api.myapp.com',
    'prefix'     => 'v1',
    'middleware' => 'cors'
], function () {
    // some RESTful resource controllers
});

How can I manage to work this subdomain? What am I missing?

Thanks in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire