Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php I';我在尝试加载css时遇到404错误_Php_Codeigniter - Fatal编程技术网

Php I';我在尝试加载css时遇到404错误

Php I';我在尝试加载css时遇到404错误,php,codeigniter,Php,Codeigniter,我刚刚开始使用codeigniter,我很难理解为什么浏览器不能呈现或加载js文件和css文件 在我的视图中,我成功地渲染了源代码 <title></title> <script src="/Scripts/jquery-1.7.1.js"></script> 您的htaccess要求将以下内容以外的任何内容路由到index.php/$1: RewriteCond $1 !^(index\.php|images|robots\.txt

我刚刚开始使用codeigniter,我很难理解为什么浏览器不能呈现或加载js文件和css文件

在我的视图中,我成功地渲染了源代码

 <title></title>
     <script src="/Scripts/jquery-1.7.1.js"></script>

您的htaccess要求将以下内容以外的任何内容路由到index.php/$1:

RewriteCond $1 !^(index\.php|images|robots\.txt)
因此,只需将脚本和css目录添加到该语句:

RewriteCond $1 !^(index\.php|Scripts|css|images|robots\.txt)

您的htaccess要求将以下内容以外的任何内容路由到index.php/$1:

RewriteCond $1 !^(index\.php|images|robots\.txt)
因此,只需将脚本和css目录添加到该语句:

RewriteCond $1 !^(index\.php|Scripts|css|images|robots\.txt)

将您的重写条件更改为下面提到的条件

RewriteEngine on
RewriteCond $1 !^(index\.php|images|Scripts|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

在上面的规则中,我们正在重新编写
http://domainName.com/home
http://domainName.com/index.php/home
除了那些在url请求URI中包含图像、脚本、css、robots.txt的url请求之外,因此通过在rewritecond中添加脚本,我们通过将所有URL传递到codeigniter index.php,将您的重写条件更改为下面提到的

RewriteEngine on
RewriteCond $1 !^(index\.php|images|Scripts|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
在上面的规则中,我们正在重新编写
http://domainName.com/home
http://domainName.com/index.php/home
除了那些在url请求URI中包含图像、脚本、css、robots.txt的url请求之外,因此通过在rewritecond中添加脚本,我们通过将所有URL传递到codeigniter index.php