With clean URLs turned on, when you have a background image in a theme, it seems to read the path of the image incorrectly, even if the path in the CSS file is, for example http://www......./images/image.jpg
For example:
I have, in my CSS file:
background-image: url("http://www.hostenz.co.nz/cms/themes/hostenz/images/tn_bg1.gif");
This works fine usually to 1 directory level, for example http://www.hostenz.co.nz/cms/admin, however if I go to http://www.hostenz.co.nz/cms/admin/access or http://www.hostenz.co.nz/cms/node/1, the images break, and the path is reported as http://www.hostenz.co.nz/cms/admin/themes/hostenz/images/tn_bg1.gif or http://www.hostenz.co.nz/cms/node/themes/hostenz/images/tn_bg1.gif.
I have tried using a variety of different paths. I figure it might be an .htaccess problem, as turning clean URLs off solves this issue. I did not have this problem on 4.6. (I still have 4.6 available at http://www.hostenz.co.nz/d46).
**update I have also tried commenting the first lines in .htaccess and replacing them with the working version from 4.6, but no go.
Where is the $base_url variable set, and would this have any effect?
Comments
Comment #1
markus_petrux commentedTry url(path/to/image) without quotes.
Also, you might want to set paths relative from the CSS file. If the CSS file and images are distributed like this:
/sites/mysite.com/themes/mytheme/styles.css
/sites/mysite.com/themes/mytheme/images/background.gif
Then you could do something like:
Comment #2
mgcarley commentedThat's how it started off. My structure is:
There is only one site running on this codebase. I'll make the images relative again, but IIRC it breaks the images on the front page as well...
Comment #3
mgcarley commentedI should note, a direct request for this file http://www.hostenz.co.nz/cms/node/themes/hostenz/images/side_p1.gif (or any image file) simply brings up the front page, which is why I thought it might be an .htaccess problem.
My .htaccess file is the default one included with Drupal 4.7-RC3, though I did try copying the first few lines from my Drupal 4.6 install - no go. As I mentioned, turning off clean-urls does fix the problem in it's entirety (but then I don't have clean urls!)
Comment #4
mgcarley commentedD'oh. Overlooked the /node/ in the URL above. Maybe it's not .htaccess then...
Comment #5
markus_petrux commentedIt seems :-)
This one works:
http://www.hostenz.co.nz/cms/themes/hostenz/images/side_p1.gif
if your CSS file is located at
/themes/hostenz/cssand your CSS related images are located at/themes/hostenz/img, then I think you would have to do something like this:Comment #6
beginner commentedIs the site still running Drupal? It seems badly broken at the moment. all I can get on each request is a 404 or 500 php script that is broken itself. Whatever the issue was, the issue today is much more serious, and apparently not Drupal related.
The issue is 2 months old, without any feedback from the reporter...
Comment #7
(not verified) commented