2

I'm a beginner to laravel. I had a laravel project, in which I have to fix some CSS. I have installed laravel 5.2 successfully and started laravel development server. But when I visit the site, it can't find any of the CSS, Image or JS file.

Failed to load resource: http://127.0.0.1:8000/public/frontend/css/stylesheet.css

However if I just remove public/, to make URL like this by editing page source in browser, it works fine.

http://127.0.0.1:8000/frontend/css/stylesheet.css

Also, if I open the site without using starting laravel development server, it can find all resources but the URL routing doesn't work. Then it couldn't find the web pages except the home page.

I know this project runs perfectly on hosting server, but I can't set it up on my local machine.

I'm using Windows and WAMP Server. Please help me to setup the project.

Himanshu Chauhan
  • 1,181
  • 7
  • 10

1 Answers1

0

To avoid this kind of problem use asset() helper to build CSS, JS and images links:

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

Also, web server should be pointed to a public directory inside Laravel project roo.

Community
  • 1
  • 1
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279