Mostafa M.K_Soft
Mostafa M.K_Soft

Reputation: 31

Laravel multilevel routing

I have a problem with laravel routing: When i use single level uri, everything is correct:

Route::get('about', 'PagesController@about');

But when i want to route two or three level uri, It shows the page like there is no CSS but in The page source the CSS assets loads correctly:

Route::get('posts/create', 'PostController@create');

load a raw page

I have this same problem when i use Route::resource('posts', 'PostController'); too.

Upvotes: 1

Views: 399

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163858

You sould use absolute paths instead of relative ones. asset() helper will help you with building correct URLs for CSS, JS and images:

<link href="{{ asset('css/styles.css') }}" rel="stylesheet">

Upvotes: 1

Related Questions