Laravel未检测到公用文件夹中的文件

2022-02-23 00:00:00 php laravel laravel-4 apache

下面的Hello People是.htaccess在公用文件夹内的代码.

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    Options +FollowSymLinks
    RewriteRule ^ index.php [L]
    # Redirect Trailing Slashes...
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
</IfModule>

好像我在公用文件夹中有一些图像."未找到错误消息显示".是否要修复此问题?


解决方案

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

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
尝试将其更改为此文件,确保此.htaccess位于您的公用文件夹内。 在应用程序内部,我有另一个.htaccess

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^ index.php [L]

RewriteCond %{HTTP:Authorization} .

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

和laravel工作正常!

相关文章