0

i have server from Digital Ocean. I use Serverpilot. How do i domain routing using by laravel 5.3 ?

Rweb example :

Route::group(['domain' => 'admin.developer.app'], function () {
    Route::get('/', function () { return view('dash') });
});

Route::group(['domain' => 'department.developer.app'], function () {
    Route::get('/', function () { return view('dash') });
});
Murat Güven
  • 25
  • 1
  • 5

1 Answers1

2

You need access to DNS zonefile settings at your DNS provider.

  • Set up a catchall DNS entry (an A record for * pointing to your server address)
  • Your .htaccess file must be set up correctly that it catches all subdomains and renders developer.app for your routing to work correctly. (I think the default laravel .htaccess is fine)
  • Add ServerAlias *.developer.app to your VirtualHost config and restart the webserver
Rápli András
  • 3,869
  • 1
  • 35
  • 55
  • Thanks for answer. DNS Records ; http://prntscr.com/djc6tv .htaccess File ; http://prntscr.com/djc77n – Murat Güven Dec 14 '16 at 13:53
  • 1
    Both looks fine, it should work now. In your VirtualHosts config, make sure that your webserver listens for the requests on all subdomains. After that, restart your webserver. – Rápli András Dec 14 '16 at 13:58
  • @MuratGüven Take a look at ServerPilot's documentation to see [how to use wildcard subdomains](https://serverpilot.io/community/articles/how-to-use-wildcard-subdomains.html). ServerPilot will take care of the server configuration. There are no Nginx or Apache files you need to modify. – Justin Samuel Dec 14 '16 at 15:48
  • 1
    @MuratGüven any error message in your webserver log? (Default locations are `/var/log/apache2/error.log` or `/var/log/nginx/logs/error.log`) – Rápli András Dec 14 '16 at 15:50