R
R
roman36942018-08-07 11:34:14
htaccess
roman3694, 2018-08-07 11:34:14

How to route subdomains in Laravel?

Hello.
I am learning Laravel and need to implement subdomain functionality. That is, so that when you go to the url subdomain1.learn.loc, the page displays: "This is Subdomain1"
Work on Open Server, the learn.loc folder is created
Base .htaccess file

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^(.*)$ public/$1 [L]

</IfModule>

Here is the route file
Route::group(['domain' => '{subdomain}./learn.loc'], function(){
 return 'This is {subdomain}';
});

The page does not open. How to change htaccess and what settings to make to make it work? Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2018-08-07
@Sanasol

https://laravel.com/docs/5.6/installation#pretty-urls
What is / doing here?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question