I am developing in xampp as host in my local. The project runs on php artisan serve
and it can be access at http://localhost:8000
Now I want to create a subdomain but in my case it didn't work. I would like to run it in http://dummyresort.localhost:8000
but it redirected to homepage.
This is my route.
Route::group(['domain' => 'dummyresort.localhost:8000'], function()
{
Route::get('/resort/dummyresort', 'FrontendController@dummyresort');
});
and this is the php artisan route:list
dummyresort.localhost:8000 | GET|HEAD | resort/dummyresort | | App\\Http\\Controllers\\FrontendController@dummyresort | web
dummyresort.localhost:8000 | GET|HEAD | resort/dummyresort | | App\\Http\\Controllers\\FrontendController@dummyresort | web
any ideas about my case?
I also create a virtual host in C:\\xampp\\apache\\conf\\extra\\httpd-vhosts.conf
<VirtualHost *:8000>
DocumentRoot "C:/xampp/htdocs/compass/compass"
ServerName localhost:8000
</VirtualHost>
制作一个虚拟主机并重试
Here is what i have found and it's working
Update Locally : ....\\xampp\\apache\\conf\\extra\\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "E:/xampp/htdocs/project_name/public"
ServerName localhost
ServerAlias *.localhost
<Directory "E:/xampp/htdocs/project_name/public">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Then Try this routing
Route::group([
'domain' => '{office_name}.localhost'
],function(){
Route::get('/', function () {
return 'I AM OFFICE OWNER';
});
});
Route::get('/', function () {
return 'I AM SITE VISITOR';
});
Run with php artisan serv
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.