简体   繁体   中英

codeigniter2 not able to load css with index.php url

I made a asset folder and in it a css folder. For accessing css files I do this:

<link href="<?php base_url()?>assets/css/css.css" rel="stylesheet" type="text/css" />

Which works 100% fine as long as the url is:

http://localhost/web/

But when i change the URL to

http://localhost/web/index.php Or

http://localhost/web/index.php/welcome/

It stops loading css or images. It must be noted that css is in the assets folder whose location is: localhost/web/assets/ where as images are in the view folder along with the php files.

My .htaccess file looks like this

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

plus my .htaccess file is in the application folder

尝试添加重写条件以排除图像和资产目录:

RewriteCond %{REQUEST_URI} !(images|assets) [NC]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM