I am creating multiple website in my local webserver. I have trouble when loading images form a css files dynamically when using subfolders.
This is my structure:
Root folder
site1
index.php (loads templates using Smarty)
.htaccess
public_files
css
js
img
templates
This is how my .htaccess looks like:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([a-zA-Z]+)$ index.php?uri=$1 [L]
RewriteRule ^(css|js|img)/(.*)$ public_files/$1/$2 [L]
Loading my css does work:
<link href="css/style.css" rel="stylesheet" />
But within this css I cannot load images
background-image: url("img/background.jpg");
I think this is because this line is called from the css folder. But when I use /img/... it will look in the root, which is also not the right place because I'm within a subfolder.