Can not get .css files from the root folder on Codeigniter 2.2.6 when changing server php version from 5.5 to 5.6

162 Views Asked by At

I use codeigniter 2.2.6 (recently it was 2.2.1. - changed it few minutes ago but problem is unsolved). The case is: when i change server PHP version from current 5.5 to 5.6 (tried to change to 7.1 first but... :-( ) i can not get root css files.

For example on PHP 5.5 i can get my main.css file by such request: https://my-domain/css/main.css, just like https://my-domain/css/bootstrap/bootstrap.min.css

But when I switch to PHP 5.6 i cant get https://my-domain/css/main.css, it redirects me to https://my-domain/404 and I still can get subfoldered css: https://my-domain/css/bootstrap/bootstrap.min.css - loads normally. BTW, files from root js folder also loads normally on any PHP version (https://my-domain/js/main.js)

Any suggestions how to fix this?

I have such folder structure:

-APPROOT/: --application/ --... --css/: ---main.css ---bootstrap/: ----bootstrap.min.css ... --js/: ---main.js ... --system

1

There are 1 best solutions below

0
Ronak Dhoot On

use base_url() function to get the url of the site

base_url() gives the url of the website where the index file is located.

eg: /my-domain/

or you can give the file location as the parameter: base_url('/css/indexpage.css') then use it as <link rel="stylesheet" type="text/css" href="<?php echo base_url('/css/indexpage.css');?>" media="all"/>