css文件无法加载到codeigniter中?
我在header.php上有这个链接。我在stackoverflow中遵循了所有正确的答案,但它仍然不适合我。有人能帮忙吗。提前感谢:) 我的文件夹结构是: 主文件夹: ci_attl -application-css-style.csscss文件无法加载到codeigniter中?,css,hyperlink,Css,Hyperlink,我在header.php上有这个链接。我在stackoverflow中遵循了所有正确的答案,但它仍然不适合我。有人能帮忙吗。提前感谢:) 我的文件夹结构是: 主文件夹: ci_attl -application-css-style.css <link href="<?php echo base_url();?>application/css/style.css" rel="stylesheet"> - not working <link href="<?
<link href="<?php echo base_url();?>application/css/style.css" rel="stylesheet"> - not working
<link href="<?php echo base_url();?>/css/style.css" rel="stylesheet"> - not working
<link href="<?php echo base_url();?>../css/style.css" rel="stylesheet"> - not working
我的.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci_attl/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /ci_attl/
RewriteCond $1 !^(index\.php|assets|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
我的控制台错误
Failed to load resource: the server responded with a status of 403 (Forbidden)
http://[::1]/ci_attl/application/css/style.css
您需要为所有资产创建特殊文件夹 如果将它们放入应用程序文件夹,则会出现403错误,因为CI中存在.htaccess规则 我建议您在根结构中创建文件夹,例如“资产”,并将所有css/js保存在其中 因此,您将以这条路径结束
http://[::1]/ci_attl/assets/css/style.css
还要确保您拥有正确的.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci_attl/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /ci_attl/
RewriteCond $1 !^(index\.php|assets|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
试着让我知道。有人帮我吗?谢谢你