0

I have a problem when laravel site suddently not working (working well before this issue happened), it's shown 404 error all files in public folder. After I fixed via htaccess and/or views, 404 error stopped but no load data in any those public files.

Please help on this issue.

not load data on laravel site

I'm trying to change htaccess and blade, stil not success.

Please advise.

My root htaccess: Options -MultiViews

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]

RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1/$2

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php

And public folder htaccess: 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]
Tuetvvn
  • 1
  • 1
  • Can you please clarify a bit more with some code examples? It's not easy to suggest something without knowing what changes you did and what's your code. – sha-1 Feb 16 '23 at 04:06

1 Answers1

0

I need see you nginx conf, or reference my conf:

location / {  
    try_files $uri $uri/ /index.php$is_args$query_string;  
}  



server {
    listen 80;
    server_name test.com;
    index index.html index.htm index.php;
    root D:/wwwroot/test/public;

    autoindex on;

    #301_START
    #301_END

    #HTTP_TO_HTTPS_START
    #HTTP_TO_HTTPS_END

    #SSL_START
    #SSL_END


    #REWRITE_START
    location / {  
        try_files $uri $uri/ /index.php$is_args$query_string;  
    }
    #REWRITE_END

    #PHP_START
    include php/php-8.1.conf;
    #PHP_END

    #PHPMYADMIN_START
    #PHPMYADMIN_END

    #DENY_FILES_START
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 403;
    }
    #DENY_FILES_END

    location ~ .+\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      1d;
        error_log off;
        access_log off;
    }

    location ~ .+\.(js|css)$
    {
        expires      1h;
        error_log off;
        access_log off;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    access_log logs/test.com.access.log;
    error_log logs/test.com.error.log;
}