This is what I did in my htaccess file in order to have clean urls:

# If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
   RewriteBase /

Now, the default theme Garland with its default colour scheme displays fine but no CSS is displayed if I change the colours or if I use an added theme like nixer.

All's good and fine locally as I don't use clean url

Is the solution to add an exception in the rewrite rules? And how would you go about it? Sorry I'm no good at rewrite rules :-( so I haven't had a go.

Your help would be much appreciated.

Comments

cog.rusty’s picture

Visit the admin/build/modules page and let it load to update the paths. Try going to admin/settings/performace and clear the cache. Clear your browser's cache or do a hard refresh with Ctrl+F5. Also try running update.php (even if there are no updates) and make sure that it completes. (The problem will probably get fixed before you do all that.)

Whenever you switch between clean URLs and ?q= URLs you will probably have the same problem. Better settle on one way and stick to it.

libre fan’s picture

Many thanks for your reply but this is not a cache problem. And I have run update.php too then emptied Firefox's cache. No change, I'm afraid.

cog.rusty’s picture

So, visiting the admin/build/modules page did not fix it...

View the html source of a page with your browser and check the paths of the theme's css files which it is trying to load. If you have enabled "Optimize CSS files" in admin/settings/performance you may need to disable that first to see the real paths, or else check if the aggregated css file has been created and exists.

If the paths used are correct and the css files exist at that location, check the permissions of the files. Can the web server read them? (permissions at least 644 for the files and 755 for their directories).

If by "changing colors" you mean the color module which changes color schemes in Garland, make sure that you are not using the "Private downloads" method in admin/settings/file-system because it is incompatible with the color module.

libre fan’s picture

Here's the css section in the head section in the HTML view of my home page:

<link type="text/css" rel="stylesheet" media="all" href="/modules/aggregator/aggregator.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/book/book.css?X" />

<link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/themes/garland/style.css?X" />
<link type="text/css" rel="stylesheet" media="print" href="/themes/garland/print.css?X" />

Many thanks for bearing up with me :-)

I have checked everything but this: check if the aggregated css file has been created and exists. I don't know where I can check this.

As I'm still setting up my Web site I haven't turned on any cache options.

The permissions for the all default themes folders are drwxr-sr-x and -rw-r--r-- for the css files. As I don't know how you note S in the octal way, I'm using the letters.

The Garland theme displays all nicely if I don't try to change its colours (through the integrated color module) on the configuration page of the Garland theme. If I change a colour, the theme no longer displays.

In sites/all/themes (drwxrwsr-x) , I added marinell: the marinelli folder is drwxr-sr-x and the files are -rw-r--r--

<link type="text/css" rel="stylesheet" media="all" href="/modules/aggregator/aggregator.css?X" />

<link type="text/css" rel="stylesheet" media="all" href="/modules/book/book.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/marinelli/layout.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/marinelli/graphics.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/marinelli/typography.css?X" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/marinelli/links.css?X" />
cog.rusty’s picture

When you change the colors in garland, it creates a directory under your "files" directory containing a bunch of css and png files. If for example your "files" directory (the one specified in admin/settings/file-system) is sites/default/files then it will create a sites/default/files/color/garland-xxxxx/ subdirectory for each of your color schemes.

- Does your admin/reports/status page complain about anything regarding your "files" and "temp" directories?
- Check if a color/garland-xxxxx subdirectory has been created under your "files" directory and it contains 2 css files and 17 png files.
- If not, make sure that your "files" directory has permissions which allow apache to write in it (try drwxrwxrwx if the "files" directory is owned by your own account and not by apache's because you created it yourself).
- If the color/garland-xxxxx subdirectory has been created but it is missing some files, check also if your "temp" directory (the one specified in admin/settings/file-system) is writable by apache. Also, sometimes some of these files are not created because of a php memory_limit problem (http://drupal.org/node/207036), because image processing takes up a lot of memory.

About marinelli, the permissions seem fine.
- Go to admin/build/themes, make sure that marinelli is enabled (the square checkbox), "configure" it, and try the "Reset to defaults" button.
- Check the "system" table in the database to see if marinelli is registered with the correct path, especially if you moved it or if you had a second copy of marinelli elsewhere.

About the "aggregated css" that I mentioned, it would create a "css" subdirectory under your "files" directory when you enable "Optimize css files", but you can ignore it for now.

libre fan’s picture

Hello,

Sorry for replying so late but I have been busy.

My Drupal is hosted by Tuxfamily. Here are some of the PHP 5 settings

max_execution_time	600	
max_input_nesting_level	64	
max_input_time	3600	
memory_limit	128M

post_max_size	128M
upload_max_filesize	128M	
upload_tmp_dir	/data/web/tmp

As a "temp" directory, Drupal suggests /data/web/tmp. I found a tmp dir inside my webspace and this could be the one: its permissions are drwxrwsr-x. It's empty.

I changed it to sites/default/files/tmp but it has no effect on my CSS problem.

The "file" dir has drwxrwsr-x

The color dir is there, same permissions. If I choose a Garland theme other than the default Blue Lagoon, a subdir is created with all the files but the CSS don't display. If I change one colour in the Garland Blue Lagoon theme, same story.

Whether the temp dir is /data/web/tmp or sites/default/files/tmp, the subdir is created.

In the database, I found a complete list of installed themes and modules in viewing the "Info" stuff but I can't find paths.

I tried disabling clean url and uploading the default .htaccess file. All in vain. Same story.

Are these SUID or SGID in the files permissions a problem?

cog.rusty’s picture

Probably the file permissions are not the problem, since the color files are processed and created. But take a look anyway in admin/reports/status to see if drupal complains about anything related to the files directory.

Look again at your theme's css paths in the html source of the page when you have changed the colors and the theme does not display correctly.
- Try a hard reload (Ctrl+F5) in your browser.
- Check if the css files that it is trying to use exist.

If the paths seem correct and the color files which the theme is trying to use do exist, but the browser can't retrieve them, check for any .htaccess file in that directory or in a parent directory which contains:
- an order deny,allow followed by deny from all
- an order allow,deny not followed by allow from all.

If you have any of those in your "files" directory, browsers will also be unable to access any of your uploaded files or images (although PHP will still be able to process files directly).

If this is not the case and the theme's css paths in the html source are wrong, what are the paths?

libre fan’s picture

Many thanks for putting up with my silly problem. I ran Drupal on two very different hosts hardly a couple of years ago (Drupal 4.x) and never had any problems at all with CSS.

Here are the paths in the page source after I made Marinelli the theme by defaut:

<link type="text/css" rel="stylesheet" media="all" href="/modules/aggregator/aggregator.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/book/book.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?A" />

<link type="text/css" rel="stylesheet" media="all" href="/modules/system/admin.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/marinelli/layout.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/marinelli/graphics.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/marinelli/typography.css?A" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/marinelli/links.css?A" />

So I checked if the CSS files exist or are accessible with Web developer Firefox add-on and I find this:

http://librefan.eu.org/sites/all/themes/marinelli/layout.css?A

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /sites/all/themes/marinelli/layout.css
on this server.</p>
<hr>
<address>Apache Server at librefan.eu.org Port 80</address>

Same thing with the rest of the CSS files.

The CSS files permissions are rw-r--r--

However there is no .htaccess file in /sites/all/themes nor in /sites nor in /all

There is .htaccess file in /sites/default/files saying:

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks

The htaccess file at the root has only this concerning "order allow,deny" or about "order allow,deny":

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
  Order allow,deny
</FilesMatch>

The files dir is in the /sites/default dir which has no write permission for anybody. Is it a bad idea to put the files dir in there? When I change one color in the Garland theme I get this 403 error in the CSS source for sites/default/files/color/garland-d0a83775/style.css?A

However the marinelli dir is in the /sites/all/themes dir

I'm wondering if the SIGD permission used by my host could be the trouble?

Locally I have this in the CSS source:/drupal/sites/all/themes/marinelli/layout.css?d

How do you account for the different ending ?d versus ?A

Though locally I have 32Mo as memory limit the Garland color settings don't show: it doesn't matter much, just that I can't compare with the online results.

cog.rusty’s picture

The error You don't have permission to access /sites/all/themes/marinelli/layout.css is probably a different problem form the one about the colors. That css file should be accessible. Besides the permissions of layout.css which are rw_r__r__ check also that the permissions of the marinelli directory are drwxr_xr_x

Those .htaccess files seem fine. Can you browse to any uploaded files or images at all?

The placement of "files" under "sites/default" should not be a problem for permissions, and it seems to work fine when the color files are being written. What are the permissions, the owner, and the group of the files/color directory?

A requirement for the color selector to show in your local installation is that the color module must be enabled in admin/build/modules and your "download method" must be "public" and not "private" in admin/settings/file-system.

I have no idea what the trailing ?A and ?d mean. Maybe someone else can help here.

libre fan’s picture

Many thanks again for your help.

I'm going to ask my host about what the SIGD permission implies in fact and who's the owner exactly. Yet locally, www-data is the owner and the group and it is enough to add myself as the main user of my Ubuntu to the www-data group to be able to administer Drupal and have the themes work fine. But of course I can't add any file to the drupal dir if I'm not root.

The permissions of the marinelli directory are drwxrws-x (I added g+w but this doesn't do anything visible).

I uploaded a picture on my online Drupal web site. It doesn't show up in the node but it sits in my image dir inside sites/default/files, both with the thumbnail. Permissions for these pictures are rw-rw-r-- (I use the image module).

Well, I'll be back next Monday.

libre fan’s picture

While still waiting for a reply from my host (a non-profit), I was wondering if a fresh install might do the trick.

I don't remember if I first install Drupal then other themes and modules or if I uploaded the whole lot (additional modules and themes) and then ran the install script. This second way may not be right at all.

I could first remove all added themes and modules, then save my DB, remove all the Drupal files and dir, and then upload them again, and connect to the existing DB.

What do you think?

libre fan’s picture

Tuxfamily said they corrected some permission errors in some places early this morning and now my added themes display fine, and I can change the colors of the Garland theme, and the image I uploaded shows up.

Many thanks to you, cog.rusty, who patiently taught me how to pinpoint the problem, so my host could solve it.

Drupal and its community are simply amazing, aren't they ;-)

Guki’s picture

1.) I used the the following rule

RewriteEngine on
RewriteBase /drupal/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^/(files|misc|uploads)(/.*)?
RewriteCond %{REQUEST_FILENAME} !\.(php|ico|png|jpg|gif|css|js|html?)(\W.*)?
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NE]

2.) Make sure that you clear any cahed CSS or images in Drupal by going to
admin/settings/performance and click "clear cahed data" button

thanks this man,t12345 from Helicon:http://www.helicontech.com/forum/forum_posts-TID-13289.htm