CodeIgniter Forums
relative paths - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: relative paths (/thread-27620.html)



relative paths - El Forum - 02-16-2010

[eluser]tim1965[/eluser]
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

/var
/www
/system
/application
/static
/css

I have been using relative paths
with base_url()../system/static/css
base_url = www.something.com/
(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.

Tim


relative paths - El Forum - 02-16-2010

[eluser]rogierb[/eluser]
I would expect a structure like

-var
--www
----static
------css
--system
--application

Where your relative path would be /static/css

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


relative paths - El Forum - 02-16-2010

[eluser]tim1965[/eluser]
Aah

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


relative paths - El Forum - 02-16-2010

[eluser]rogierb[/eluser]
Yes correct.

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


relative paths - El Forum - 02-16-2010

[eluser]mattpointblank[/eluser]
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.


relative paths - El Forum - 02-17-2010

[eluser]tim1965[/eluser]
matt

i think we are saying the same thing.

Rogierb

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.