I have this headace that caused me 30 hours of fault-finding as a total NOOB before I found out that
I could not display images on my site because Drupal somehow added a file (.htaccess) in sites/default/files
that effectively blocked all image content I made with Drupal.

I removed this file of course. But Drupal keep adding it back from time to time.

How do I solve this issue?

Comments

kitsunechan’s picture

This isn't going to help your .htaccess question, but when you say "I could not display images on my site" is this when you are creating a post? Right under the text box for the body of posts (in edit mode for a node) there is a collapsed option for the input type. Make sure you choose "Full HTML". It took me a while to realize why a lot of my tags and all images weren't showing up in posts. It's because I wasn't choosing "Full HTML" as my input type. Not sure if this is your issue too. Just making sure you know about it.

JoOngle’s picture

Hi Kitsunechan, and thank you for your attention.

No - my settings are for everyone - Full HTML, even for guests.
Trust me, I've been checking the filters back & forth.

I just have NO clue why Drupal periodically adds .htaccess to the /sites/default/files directory. I really don't want it to! because it actually
prohibits the display of images in nodes!

bsenftner’s picture

Are you sure that it is Drupal placing these .htaccess files?

I have about a half dozen different live Drupal sites that I'm maintaining, and all of them only have one .htaccess file, at the root of the Drupal install. None of them have a .htaccess inside the /sites/default/files

I do seem to remember something like this occurring with a site I was building at the start of the summer, but after going from one drupal version to the next (6.11 to 6.12 maybe?) that stopped...

JoOngle’s picture

Are you saying it's my host that inserts these files?

bsenftner’s picture

I have no idea how it's happening, but I'm saying it's not normal. A standard install of Drupal doesn't do this, at least in my experience. Maybe a module you're using? I just guessing here...

smokey1300’s picture

Something is randomly adding .htaccess to the default/files directory that stops any pictures from displaying from these directories.

It has caused me hours of grief until I read someone having the same and simply just deleted it.

Anyone have any thoughts?

heine’s picture

Empty the file.

armanschwarz’s picture

Hmm, interesting. I am having a serious of permissions problems that seem to elude everyone (posted here: #960702: Getting a flood of errors relating to permissions with every cron run

I also seem to have .htaccess files popping up all over the place, here is the content of the .htaccess file in default/files/js:

<Files *.js.gz>
AddEncoding x-gzip .gz
ForceType text/javascript
</Files>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)\.js $1.js.gz [L,QSA]
</IfModule>

here it is for my default/files folder:

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks

It doesn't exist in the default folder so I suspect this isn't my host's fault. I would suspect this is caused by the JS Aggregator or CSS gzip modules but I get similar problems (php errors during cron) when filefield tries to delete files that I've uploaded without submitting the node (they normally get deleted after 6 hours; they don't in my case I just get errors!).

Any help would be greatly appreciated!