I'm creating web application which needs dynamic domain per user.
Let say I've 5 users in my DB such as.
1) wanda
2) edward
3) rick
4) maurice
5) kristin
Now I've a domain as example.com.
I want to get data of that 5 users as per his domain.
1) wanda.example.com
2) edward.example.com
3) rick.example.com
4) maurice.example.com
5) kristin.example.com
route.php
Route::group(['domain' => '{user}.example.com'], function () {
Route::get('/', function ($user) {
echo $user;
exit;
});
});
I'm using Xampp, Apache server so I configure httpd-vhosts file as
C:\xampp\apache\conf\extra\httpd-vhosts
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/myproject"
ServerName example.com
ServerAlias *.example.com
DirectoryIndex index.php
<directory "C:/xampp/htdocs/myproject">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>
C:\Windows\System32\drivers\etc\hosts file
127.0.0.1 example.com
127.0.0.1 *.example.com
When I access
user.example.com
I'm Getting this error.
I want this type of dynamic domain as works.
http://wanda.thewallchat.com/
http://edward.thewallchat.com/