Setting Document Root for Laravel Project on Apache Virtual Host

Creating virtual host for laravel in Lamp

Solved

Basically I just created the virtual host but I noticed some strange behaviour in laravel after placing subdomain on top of file it worked. I didn't knew that laravel would process suddomain routes first and if you place subdomain routes after some routes then it didn't work then you would not get desired routes.

About apache it seems that I couldn't make the subdomain work and from what I have learned in local environment how it works is that domain must come first here.

ServerAlias blog.example.dev didn't work in ServerName example.dev domain.

I created two seperate virtual host one for example.dev and another for blog.example.dev. Also thanks to parthu_panther I changed the .dev to another .local.

Also the hosts file was same

127.0.0.1 example.local

127.0.0.1 blog.example.local

Please correct me if I am wrong.

laravel virtual host setup not showing front-end

You need to address your public folder,

<VirtualHost *:80>
DocumentRoot "C:\XAMPP\htdocs\blog\public"
ServerName blog.local
</VirtualHost>


Related Topics



Leave a reply



Submit