I just installed Drupal on the staging server it is windows 2003 running IIS6 I am using Helicon to run a .htaccess file for clean urls. Everything was working great Friday and then I come in today and the images are not loading.

The clean URL's are working and I am able to navigate around the site, just no images.

The clean URLs work:
/sites: directory listing denied
/sites/default: directory listing denied
/sites/default/files: Drupal's Page cannot be displayed

All of my images are in /sites/default/files/images ..... so as you can see its breaking on the /files part of the url

If I delete mysite.com/.htaccess file...... all of the images load... but the clean URL's don't work.

I cannot for the life of my figure out what might have changed since friday...

Here is the contents of my .htaccess file.. can anyone tell me why .htaccess is breaking when i get to /sites/default/files??

I really appreciate any help this has be quite stumped!

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|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>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
  # There is no end quote below, for compatibility with Apache 1.3.
  ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

  <FilesMatch \.php$>
    # Do not allow PHP scripts to be cached unless they explicitly send cache
    # headers themselves. Otherwise all scripts would have to overwrite the
    # headers set by mod_expires if they want another caching behavior. This may
    # fail if an error occurs early in the bootstrap process, and it may cause
    # problems if a non-Drupal PHP file is installed in a subdirectory.
    ExpiresActive Off
  </FilesMatch>
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment and adapt the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.90.2.5 2010/02/02 07:25:22 dries Exp $

Comments

cog.rusty’s picture

This is normal behavior. It is what happens on all my sites. The change in behavior in "files" is caused by the small .htaccess files which Drupal puts there for security reasons (to disable the php handler).

I would take one specific broken link from the source html produced by the page, and examine it. I would try to think like a browser, and I would try to resolve where the link leads in the context of the page where it appears. Then I would check whether the file is where the browser is looking for it.

Two common causes of broken links when using clean URLs are
- relative paths don't work (node/15/sites/default/files...)
- absolute paths break when moving a site to a different URL path (/urlpath/sites/default/files...)

trickar’s picture

Hello,

I have this issue too. Every time I upload an image to Drupal it puts the small .htaccess file in to the files folder and the images do not display. I can delete this .htaccess file and the images display OK.

Is there a way to stop Drupal putting in this .htaccess file?

My host can only read Mod Re-write in .htaccess

Would really appreciate your help.

cog.rusty’s picture

If your files links are broken by the small .htaccess file in "files", you can try to edit it and remove the two "Options" lines and leave only the first line.

If the file exists Drupal won't try to create it again.

trickar’s picture

Hello,

Thank you for your reply. As I got further down the road I realised that I was going to come across one hurdle after another with my existing hosting company.

I had already had to strip out most of the main .htaccess file and would have had to strip this one. Plus I was going to have to make modifications to make email work and it was all becoming too much hassle.

Not an ideal solution to problems but I moved host. Now I have a great Drupal training site set up (I am brand new to this) and everything works.

Thanks again for your reply.

Abyooda’s picture

Hi All;

I tried deleting, renaming, replacing also I tried deleting the two options lines and keeping the first line of the .htaccess file but still my logo and my file doesn't appear, FYI I am using iis7 as hosting server and .htaccess keeps on recreating everytime i refressh my page, what is the solution to stop recreating the .htaccess file? thanks in advance

Regard's