Jarloyz Juarez
Jarloyz Juarez

Reputation: 13

can't accest to subfolders in public from laravel 5.6 error 404 on /css/app.css and every file in the sub folder

hello i am new on laravel and i am trying to put some css localy but not work, i try every think to i find here but nothing work

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

i try with these code and not work. still try go to http://localhost:8000/js/app.js but still saying error 404, i don't understand what happend.

i changed the permission for all files and not work too, this is my public/.htacces

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

i hope to someone help me, thanks

Upvotes: 0

Views: 834

Answers (1)

Azraar Azward
Azraar Azward

Reputation: 1624

In your blade file where you are declaring the assets try:

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

You can know more: https://laravel.com/docs/5.4/helpers#method-asset

Laravel masks the /public route, That's why your home directory is "/" instead of "/public/index.php"

Upvotes: 1

Related Questions