CodeIgniter Forums

Full Version: relative paths
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Apologies for this, i know its relatively easy but i am having a bad day.

I have just moved both my system and application folder out of /var/www/

so dir structure looks like this


I have been using relative paths
with base_url()../system/static/css
base_url =
(index.php removed)

so my question is what should i use now, are they relative to their location or to var/www/

Thanks in advance.


El Forum

I would expect a structure like


Where your relative path would be /static/css

You cannot reference the static/css directory if it is not in your webroot.

El Forum


Ok this is my first time with this structure, so aplogoies for any stupid questions. Is it only the system and application directory that can be above root and everything else(i.e. cdd,javascript, static web site images, user photo upload directory) must sit under /var/www.

Thanks in advance

El Forum

Yes correct.

Moving things out of your webroot makes it inaccessable through the webserver.

El Forum

Personally I make an 'assets' folder inside the CI install root (eg in the same directory as index.php) and put folders for /css/ or /js/ or /img/ in there. Then everything can be references with base_url() . 'assets/img/logo.jpg' etc.

El Forum


i think we are saying the same thing.


I now have CI install and application sitting under var/system. Everything else is sitting under var/www which for me is CSS, Javascript, my static images for website, and a photo upload area for users. It looks to be working ok, i am going to test for the next few days.
Many thanks to both of you for your help.