0

After hours of research for the right keyword to implement a simple way of using wild card dns on laravel.

Here I'm using windows 10 and laragon.

This is the code I tried to implement in laravel route

Route::group(['domain' => '{account}.tindahan.local'], function() {
  Route::get('/page-one', function () {
    return view('welcome0');
  });
  Route::get('/page-two', function () {
    return view('welcome1');
  });
});

Base on the articles I read which you need to setup something like *.domian.com on vhost I have this automatically set in laragon

<VirtualHost *:80> 
    DocumentRoot "C:/laragon/www/tindahan/public/"
    ServerName tindahan.local
    ServerAlias *.tindahan.local
    <Directory "C:/laragon/www/tindahan/public/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

But when I tried to visit page-one.tindahan.local on Chrome browser I got this message

This site can’t be reached

I don't know what's missing of what I am doing. This is the first time I am doing something like this, so basically I don't have lots of idea.

Can you give me the right way to implement this?

Fil
  • 8,225
  • 14
  • 59
  • 85

1 Answers1

1

For sure you should add entries to your hosts file (On windows usually C:\Windows\System32\drivers\etc\hosts). For example you should have:

127.0.0.1 tindahan.local

for main domain, but you should also add other subdomains for example:

127.0.0.1 page-one.tindahan.local
127.0.0.1 page-two.tindahan.local

and so on

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
  • What I'm looking for is the implementation of something like in this article, https://www.quora.com/How-does-slack-create-DNS-for-teams-on-the-fly-like-teamname-slack-com. I wonder how can I do that simply with laravel. – Fil Nov 11 '17 at 19:10
  • Yes I understand but you asked what you have missed so you probably missed adding domains to hosts to test it on your local machine – Marcin Nabiałek Nov 11 '17 at 19:12