TrafalgarD's avatar

Laravel installation on subdomain

Hello everyone, I am new here and laravel beginner.

I have two installation of Laravel. The principal project and the admin section that I have choose to build it in a new laravel installation. I want to make the admin section, a subdomain of the principal project.

This is my directories architecture in the cPanel :

web/

    /admin/ ( admin.mywebsite.com)

    /laravel/(mywebsite.com)

My domain points on the directory web/laravel/public and all work well. mywebsite.com work fine.

Now I don't know how to implement the subdomain.

Need some help please and apologize for my english.

0 likes
4 replies
mrabbani's avatar

Set the root path of your subdomain admin.mywebsite.com to web/admin/public path.

TrafalgarD's avatar

How an I do that, I have follow my web host 's directives to implement the subdomain. First I create an alias admin.mywebsite.com and I add these parameters to the .htaccess

RewriteEngine On

 RewriteCond %{HTTP_HOST} !^www

RewriteCond %{HTTP_HOST} ^(.*)\.mywebsyte\.com

RewriteRule ^(.*)$ http://mywebsite.com/%1/$1 [L,NC,P]

The link admin.mywebsite.com redirect me to mywebsite.com/admin

I don't see an option to set subdomain root path. Can you explain me how ??

TrafalgarD's avatar

Thanks for your answers but I don't understand how that can help me. This the the laravel doc for subdomains

Route::group(['domain' => '{account}.myapp.com'], function () {
 Route::get('user/{id}', function ($account, $id) {
        //
    });
});

In my case the subdomain is a new laravel installation.

Please or to participate in this conversation.