我在登录页面后在我的代码点火器项目中使用了重定向。
喜欢
redirect('profile/edit/1');
并且看到一个类似 URL
http://mypreoject.com/index.php/profile/edit/1
并且,我的页面背景图像无法加载。
我使用了.htaccess模式写入,所以这不应该发生,我应该得到以下内容。
http://mypreoject.com/profile/edit/1
如果您使用的是 Apache,请在根 Web 目录中放置一个 .htaccess 文件,其中包含以下内容:
RewriteEngine on
RewriteCond $1 !^(index'.php|[Javascript / CSS / Image root Folder name(s)]|robots'.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
如果 CI 控制器 -> 操作在两个 url 中都工作正常
http://mypreoject.com/profile/edit/1
http://mypreoject.com/index.php/profile/edit/1
那么.htacces
没问题,你应该检查/application/config/config.php
index_page
键
改变
$config['index_page'] = 'index.php';
自
$config['index_page'] = '';