I have set up a laravel 5.2 project on a vps which uses cpanel.
I've configured the subdomain to point to the public folder within the subdomain folder and the app loads as expected.
However my login page is unable to load any assets - it comes up with an not found http exception
for any of the assets.
for example: http://subdomain.domain.co.uk/css/app.css
.
Once I log in the assets load correctly in all other pages - just not the log in one. If I then log out and log in again then the assets all load correctly.
Just not sure what's stopping the assets loading and for laravel to try and treat a path to a css file as a route.
Any help appreciated
Additional Information:
Here's the mark up for including the css:
<link rel="stylesheet" href="/css/app.css">
I've also tried:
<link rel="stylesheet" href="{!! asset('css/app.css') !!}">
This is identical to the pages that load the assets once logged in.
Folder Structure
Root/ (a few folders for brevity)
subdomain
app/
http/
routes.php
public/
css/
app.css
js/
app.js
vendor
The server points to `subdomain\public' as normal laravel setup
It's still happening each time the cache is cleared and only corrects once logged in and only affects the login page
I am noticing that on L5.2 in the public directory it does not include a CSS folder.
Here is the repo's folder for reference: https://github.com/laravel/laravel/tree/5.2/public
This leads me to believe the assets need to be initially compiled via a gulp
command which will run Laravel's Elixer and generate the assets.
From the projects root folder run
gulp
or sudo gulp
Take note, if you have not pulled in the assets you will have to run
npm install
or sudo npm install
first. Here is the out the box NPM packages pulled for reference: https://github.com/laravel/laravel/blob/5.2/package.json.
And if you cannot install using npm
you will need to install node.js first.