0

I had multisite previously, two sites sharing same codebase like but having their own files system: -

  1. site1 -> sites/site1/files/FILES_HERE
  2. site2 -> sites/site2/files/FILES_HERE

Now I am trying to separate the sites to its own sites and separate codebase to use the normal Drupal structure like: -

  1. site1 -> sites/default/files/FILES_HERE
  2. site2 -> sites/default/files/FILES_HERE

but somehow whenever I clear the cache, it creates folder like: -

  1. site1 -> sites/site1/files

and uses this instead of /sites/default/files

To overcome that I added some config in settings.php file

$conf['file_public_path'] = 'sites/default/files/';
$conf['file_temporary_path'] = '/tmp';

Now, the site1 uses proper file i.e. /sites/default/files but it creates .htaccess files inside sites/default/files/ folder. The .htaccess file contains:

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

The images in the website doesn't load properly because of this file. If I delete this file the Images load properly, but while clearing the cache the file is auto generated and again the image doesn't load.

File permission is not an issue here as its 775 universal except for settings.php file.

1 Answer 1

1

The main culprit was extra trailing / in the files path in settings.php file. Which I changed to

$conf['file_public_path'] = 'sites/default/files';
$conf['file_temporary_path'] = '/tmp';

And deleted the .htaccess file, now the files inside sites/default/files are readbale by server even after clearing the cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.