John Davidson

php - All static files result in 404 error in laravel on server run

0 comments
Message:


When I host my website on the live server with cpanel then the website is working perfectly but when I host the site on my local host then it gives so many problem.



I am trying to solve this from last 10 hours and totally onto it still can't find the solution please help me :( :(


It gives this error =


Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
img2.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)

Please give me the solution : (



My Answer:
It seems like the issue is related to the paths of your static files not being correctly configured in your Laravel application. Here are a few steps you can take to troubleshoot and potentially resolve the issue:

1. Check the paths of your static files in your HTML/CSS/JS files and make sure they are correctly pointing to the files in your public directory. For example, if you have an image file called "img2.jpg" in your public/images directory, make sure the path in your HTML file is something like ``.

2. Make sure that the files actually exist in the correct directories on your local server. Check the public directory of your Laravel application to ensure that the static files are present.

3. Clear your Laravel application cache by running `php artisan cache:clear` and `php artisan config:clear` in your terminal.

4. Check your server configuration to make sure that it is correctly serving static files. You may need to configure your server to allow access to the public directory of your Laravel application.

5. Check your .htaccess file in the public directory to make sure it is correctly configured to allow access to static files. You may need to add rules to allow access to certain file types.

If you have tried these steps and are still experiencing issues, please provide more information about your server setup and Laravel configuration so that we can better assist you.

Rate this post

5 of 5 based on 4686 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us