6 months ago

Laravel 6+ VPS images failing to load and showing error 404

Posted 6 months ago by Seeker1337

Hello. I've recently uploaded my website to a VPS ( ubuntu 18.04 with Webmin/Virtualmin/LAMP ) and everything is working properly except the images. I didn't change any route or anything related to them and they work just fine on my localhost.

EDIT: Since the path is correct and I've linked the storage folder I'm sure it's a permissions' problem. I tried with -- sudo chmod 775 -R storage -- but it still won't work..

All my images are stored in storage/images folder. Let me show you my code on retrieving them and the error afterwards:

<img src="../storage/images/header/header-1.jpg" class="images">

And the error being:

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

Here is also my current .htaccess configuration:


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

    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]

Please sign in or create an account to participate in this conversation.