简体   繁体   中英

After redirecting the page CSS is not getting fetched in codeigniter

After redirecting the page the css and js which are stored in the assets folder, is not getting fetched in that redirected page.

Here is the code to redirect the page, the name of this page is interior.php

<a class="viewall pull-right" href="<?php echo base_url("details/profile/".$article->type_id); ?>">

The page it is getting redirected to is profile.php, here is the css link in this page:

<link rel="stylesheet" href="../assets/css/style.css"/>

Along with the css and js, I am also not getting the images stored in the img folder inside Assets folder. The assets folder is inside the application folder at the same level as views folder.

Instead of using relative URLs, use absolute URL. You can use base_url() to achieve this in the following manner:

<link rel="stylesheet" href="<?php echo base_url('assets/css/style.css'); ?>"/>

For the above code to work, you need to move your assets folder into the base directory (one level above application).

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