0

My CSS and JS file in public folder on localhost, but Its not working. I use laravel 5.2. I tried a lot of ways but still failed.

I don't want to use , <link href="{{asset('/css/app.css')}}" rel="stylesheet">

I used :

<link href="public/css/app.css" rel="stylesheet">

But It's not working. Please, give me solution. What do I do about this?

Thank you.

1 Answer 1

0

You will first need to create assets folder in your public folder then put css folder and all css files into it then link it like this :

<link href="assets/css/app.css" rel="stylesheet">

Hope that helps you!

For more view this

Update as per comment

check your .htaccess file use this

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_URI} !^/public/ 

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ /public/$1 
#RewriteRule ^ index.php [L]
RewriteRule ^(/)?$ public/index.php [L] 
</IfModule>

Hope this work

Sign up to request clarification or add additional context in comments.

6 Comments

But, This project create our previous developer. this project already created and run successfully. I have set in local. He used ,e.g., <script src="/public/assets/frontends/script/jquery.mixitup.js"></script> But It's not working without changes. It's possible. Please say to me, What I do?
You mean the project work in live properly but locally linking not working?
Yes, the previous developer used it and live in run, but not working in my option. Can other setting, that i forgate.
check the update ans hope it will help you maybe you forget to update your .htaccess settings.
Sorry,.htaccess settings not work. I writed : <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} !^/public/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /public/$1 #RewriteRule ^ index.php [L] RewriteRule ^(/)?$ public/index.php [L] </IfModule> Response : **Not Found The requested URL /public/help was not found on this server. Apache/2.4.33 (Win64) PHP/7.2.4 Server at localhost Port 80**
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.