Webroot中的CakePHP图像未在生产中显示

2nbm6dog  于 2022-11-11  发布在  PHP
关注(0)|答案(1)|浏览(131)

我昨天已经把我的网站推到生产,所有的工作正常与3 .htaccess文件我创建。唯一的问题是,从我的webroot文件夹的图像没有显示。我调用他们与**$this-〉Url-〉image('pages/' . $page-〉image)**
以html呈现的链接:
浏览器:/app/img/pages/home.jpg

'App' => [
    'namespace' => 'App',
    'encoding' => env('APP_ENCODING', 'UTF-8'),
    'defaultLocale' => env('APP_DEFAULT_LOCALE', 'fr_FR'),
    'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'Europe/Brussels'),
    'base' => false,
    'dir' => 'src',
    'webroot' => 'webroot',
    'wwwRoot' => WWW_ROOT,
    //'baseUrl' => env('SCRIPT_NAME'),
    'fullBaseUrl' => false,
    'imageBaseUrl' => 'img/',
    'cssBaseUrl' => 'css/',
    'jsBaseUrl' => 'js/',
    'paths' => [
        'plugins' => [ROOT . DS . 'plugins' . DS],
        'templates' => [ROOT . DS . 'templates' . DS],
        'locales' => [RESOURCES . 'locales' . DS],
    ],
],

/var/htdocs/.htaccess文件夹中的文件

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

/应用程序/.htaccess

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule    ^$    webroot/    [L]
  RewriteRule    (.*) webroot/$1    [L]
</IfModule>

/应用程序/webroot/.htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [L]
</IfModule>
  • 谢谢-谢谢
ghhkc1vu

ghhkc1vu1#

这是我的错误日志
2021年10月21日13:18:34错误提示:[异常]无法找到控制器类Img。无法找到控制器类Img。位于第226行上的“堆栈跟踪:

  • ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  • ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

请求URL:/img/pages/home.jpg

相关问题