I am currently working on a CMS where each websites has his own folder to contain dependencies, images, files and scripts, specific for this website.
The folder structure looks like:
/http_docs
|
|--- CMS root
| |
| |---- index.php
| |
| |---- includes
| | |
| | |--- js
| | |
| | |--- css
| | |
| | |--- other dependencies
| |
| |---- scripts (etc..)
|
|---- Somewebsite
| |
| |---- files
| | |
| | |---- images
| | |
| | |---- uploads
| |
| |---- sources
| |
| |---- css
| |
| |---- js
|
|---- some-website...
Some of the CSS files in the website contain relative URLs to the image path. These URLs look like this:
.robot {
background-image: url('/files/images/some-image.jpg');
}
This works well if the website is loaded from an URL outside the CMS. E.g. http://some-website/files/images/some-image.jpg.
In the httpd.conf the root of the external domains is set to the website root and thus the files are loaded without problems.
The problem arises however, when the CSS-files are loaded into the CMS builder, which is a specific page in the CMS where you can add and remove elements from the page, the images are not loaded. This is because, of course, the root of the CMS is not the same root of the some-website.
Question
Is there a way to solve this without completely rewriting all the CSS files?
If the answer is no, would you know of a tool that would make my work easier?