【问题标题】:No css , js, image file is loading on the website. My website is based on codeigniter网站上没有加载 css、js、图像文件。我的网站基于codeigniter
【发布时间】:2017-10-24 19:06:54
【问题描述】:

我的 index.php 文件位于 pubic_html 中,所有其他文件夹(例如 application 、 assets 、 system )都在那里。它们每个都有子文件夹和文件。我正在尝试基于 codeigniter 恢复网站,并且我已按照安装指南进行操作,但 css 文件存在问题。

网站上只有文字,没有css,也没有图片。

这是一个如何在文件中写入链接的示例。

<link rel="icon" type="image/png" href="<?php echo base_url();assets/img/logo.png">

此代码在我的 htaccess 文件中:

RewriteEngine on

RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^=]+=.*)$ index.php?controller=$1&$2 [L,QSA]
RewriteRule ^([^=]+=.*)$ index.php?$1 [L,QSA]
RewriteRule ^(.+)$ index.php?controller=$1 [L,QSA]

我附上了网站的屏幕截图和我面临的问题。我已经尝试了一切。如果有人可以提供帮助,将不胜感激。谢谢。

【问题讨论】:

  • 你的.htaccess喜欢什么?
  • 'RewriteEngine on RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^=]+=.*)$ index.php?controller=$1&$2 [L,QSA] RewriteRule ^([^=]+=.*)$ index.php ?$1 [L,QSA] RewriteRule ^(.+)$ index.php?controller=$1 [L,QSA]'
  • 这是我的 htacess 中写的代码
  • 请直接插入您的帖子中。
  • 确保您已在 config.php 示例 $config['base_url'] = 'http://localhost/yourproject/'&lt;?php echo base_url('assets/img/logo.png');?&gt;" 中设置了基本 url

标签: javascript php html css codeigniter


【解决方案1】:

我找到了我的解决方案: 基本上我必须更改 config.php 文件强制 URI_request https://www.formget.com/codeigniter-htaccess-remove-index-php/

【讨论】:

    猜你喜欢
    • 2015-06-07
    • 2011-07-05
    • 1970-01-01
    • 1970-01-01
    • 2023-01-11
    • 2015-01-28
    • 2019-11-20
    • 2020-12-26
    • 2014-12-30
    相关资源
    最近更新 更多