Apache2 includes directive for images, css, and js
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Apache2 includes directive for images, css, and js
Hi. So, I feel like I've been banging my head against a wall for the last few days, so I'll ask for some help. I have a whole mess of php based reports that I am trying to organize. These reports live on an apache2 server. There were originally 5 reports for some basic sales data for the company I work for. Well, 5 turned into 6, and the 12, and before I knew it (a year and a half later) there are hundreds of reports. Many of them share large bits of code, and quite a few of them are just duplicates of each other. Many others are outdated and no longer used. Along the way, we've started using a javascript calendar, company logos, css, etc. The trouble is, many of these are duplicated as well.
I have created a new virtual host, and I want to keep from duplicating content. I made directories for outside libraries (like my js calendar), includes (for my php bits that I want to keep from duplicating), images, and css. My goal is that my "reporting suite" be maintainable and portable (with as few changes as possible).
To cut my story down, I'll skip to the part where I created a php_value include_path "/path/to/application" in my virtualhost directive. My php include files load up fine relative to my include_path, html code in those files referencing javascript, css, and images all ignore this path. So, I wind up with broken images, no css, and no js? Is there a way to make all of this work?
As far as I know images, css and js should be accessible by the browser (client) and therefore they should be in (a subdirectory of) the document root.
I realized after posting this (and seeing your reply) that this needs a little clarification from me. When my included php references js, css, and images, it seems to reference them relative to the main page (the one calling the included file). This doesn't work for me, because I need to be able to use these included files from anywhere in my "application". I can't seem to make fully qualified paths work for js/css (particularly css images). Am I missing something?
Wow. Wim, that did it. I'm bummed I wasted a few days on a couple of leading slashes, but it's done. Thanks so much! You're a lifesaver. We can mark this one solved.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.