Ad
Laravel Routing To Subdomain
I am using Laravel 5.7. Currently have all the route go through Api.php
, web.php
, and website.php
. In live version of the app, there is a subdomain pointing to website.php
is [anything].websiteaddress.com
, and domain www.websiteaddress.com
is pointing web.php
. In local environment, how can I access subdomain using localhost:8000
. I have tried to use [anything].websiteaddress.com
, it does not work. What is proper way to access subdomain?
Ad
Answer
1.Configure in Web server httpd.conf create virual Host ip or name what you want
<VirtualHost *:80>
ServerName website.com
ServerAlias *.website.com
</VirtualHost>
2.route configuration like
Route::group(array('domain' => '{account}.website.com'), function() {
Route::get('/', function($account, $id) {
// ...
return Redirect::to('https://www.website.com'.'/'.$account);
});
});
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad