0

I am developing a project in CodeIgniter but facing the following problem:

I have following codes inside my view file(header):

<link rel="stylesheet" type="text/css" href="<?php echo base_url("includes/custom/css/slider-settings.css"); ?>">

On localhost it generates:

<link rel="stylesheet" type="text/css" href="http://127.0.0.1/radiant/includes/custom/css/slider-settings.css">

There is no problem when running on localhost every css & js files being loaded perfectly. But When I upload it to live server(to a subdomain of an existing website) no file is getting included there. I have been trying to solve it all the way possible but couldn't.

My directory structure is

Radiant// root of CI
      - application
      - system
      - includes
        ----- custom
              ------css
                   ----navbar-setting.css
                   ----sidebar-setting.css
              ------js
              ------common

In localhost there is no problem but when uploaded to a subdomain, no file is being included.

Any help regarding this would be greatly appreciated.

1
  • check http or https, change .htaccess according to this Commented Aug 17, 2016 at 15:02

1 Answer 1

4

OK well let me explain. this is your css href "http://127.0.0.1/radiant/includes/custom/css/slider-settings.css"

In here this path includes/custom/css/slider-settings.css is the absolute path of your CSS file. So as you have added in file structure there is no issue on the path. And this is http://127.0.0.1/radiant/ base url defined path.

So when we came to base_url it will be various from one to another. It means what you set in config.php base_url() it will echo the value where ever you called.

All the time we use base URL as our project root folder. You mentioned on the question to a subdomain of an existing website. It means in config.php baseurl should look like this(look at second one)

$config['base_url'] = 'http://stackoverflow.com/'; # root folder of the host
$config['base_url'] = 'http://chat.stackoverflow.com/'; subdomained pointed URL
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.