Php I';我在尝试加载css时遇到404错误
我刚刚开始使用codeigniter,我很难理解为什么浏览器不能呈现或加载js文件和css文件 在我的视图中,我成功地渲染了源代码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
<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