Cannot access public folder via Url - Laravel 10 / Apache

245 Views Asked by At

having an issue accessing anything stored in the public folder of my Laravel project (net::ERR_INVALID_HTTP_RESPONSE). To get as basic as possible I tested it on a brand new project, after reinstalling MAMP and made sure the DocumentRoot folder was right. So I initiated composer create-project laravel/laravel, created an 'images' folder inside public and put an image inside of it. Then in the homepage:

<img src="{{ asset('images/logo.jpg') }}" alt="">

The console says

GET http://127.0.0.1:8000/images/logo.jpg net::ERR_INVALID_HTTP_RESPONSE

and the image won't load.

(even tried typing http://127.0.0.1:8000/images/logo.jpg in the URL and got the same message)

I tried modifying the .htaccess in various ways found online and none worked.

Modified the Apache conf as well and nothing worked.

The only thing that made the image load was running the command php -S localhost8000 -t public

but this carries other problems, plus I need to run my project via php artisan serve.

Can you please help me?

0

There are 0 best solutions below