I am trying to implement static and dynamic subdomain routing in my application. It is not working as expected. I am using WAMPServer in my local machine.
routes.php
Route::get('/', 'WelcomeController@index');
Route::group(['domain' => 'api.letsplay.dev'], function () {
Route::group(['prefix' => 'v1'], function () {
Route::get('users', function () {
return "Success";
});
});
});
php artisan route:list gives this
+------------------+----------+----------+------+----------------------------------------------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+------------------+----------+----------+------+----------------------------------------------+------------+
| | GET|HEAD | / | | App\Http\Controllers\WelcomeController@index | guest |
| api.letsplay.dev | GET|HEAD | v1/users | | Closure | |
+------------------+----------+----------+------+----------------------------------------------+------------+
hosts file has this
127.0.0.1 localhost
127.0.0.1 hosp.dev
127.0.0.1 letsplay.dev
I use the .htaccess file provided by the laravel framework without any change
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@letsplay.dev
DocumentRoot "c:/wamp/www/letsplay-web/public"
ServerName letsplay.dev
ErrorLog "logs/letsplay.dev-error.log"
CustomLog "logs/letsplay.dev-access.log" common
</VirtualHost>
When I tried to hit letsplay.dev
from my browser, It is working as expected. but while trying to hit api.letsplay.dev/v1/users
, I get ERR_ICANN_NAME_COLLISION
in Chrome and the below error from IE!
Help me to understand what am I missing!