0

I have an .htaccess file with Options Indexes FollowSymLinks, my /apache2/sites_available/default file also has these options and AllowOverride All.

If I do these things outside of Drupal it's working (if I go to a directory without an index file, I see a file directory listing), but inside Drupal I'm getting

The requested page "/sites/default/files/" could not be found.

Also, I am able to to access files within the files directory. For example if I went to /sites/default/files/someFile.pdf... it would be able to access it fine. I want to have it so that if I link to a directory within the files directory and that directory does not have an index file... it will display a directory listing of all the files/folders within. Something like:

http://3.bp.blogspot.com/_rhuioznu6Us/TBmeWAr_G2I/AAAAAAAAAFE/tKCclPXdq2M/s1600/apache.png

I think Drupal is doing something based on the fact that I get my Drupal headers above the message that the page couldn't be found. How do I stop this?

The files below show some of the things I've tried...

apache2/sites_available/default contains:

DocumentRoot /var/www/default              
<Directory />                              
  Options Indexes FollowSymLinks           
  AllowOverride All                        
</Directory>                               

<Directory /var/www/default/>              
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All                        
  Order allow,deny                         
  Allow from all                           
</Directory>

default/files/.htaccess contains

Options +FollowSymLinks
Options +Indexes
RewriteEngine Off

1 Answer 1

1

You don't need the Indexes on your web server. Its actually not recommend on a live environment. For testing purpose it can be useful sometimes.

If you don't have your files directory I would recommend you to created a files directory

sudo mkdir sites/default/files # Creating files directory
sudo chmod a+w sites/default/files # Permissions

After that you can you try this on your default configuration file...

<DIRECTORY />
      Options FollowSymLinks
      AllowOverride None
 </DIRECTORY>

 <DIRECTORY /var/www/drupal_site/>
     Options +FollowSymLinks
     AllowOverride All
 </DIRECTORY>

Source: https://github.com/darol100/lazydubuntu/blob/master/bin/includes/skeleton

And then re-start your server.

If this does not solve your problem here is a similar question (with the same error)

And here is the answer.

This is a known problem, a natural result of clean URLs

So, when you use clean URLs the file links must have a front slash (and possibly a path if Drupal's home page contains an URL path). The browser sees the absolute path "/files/filename" and resolves it using the bare domain name. You need to edit all the file paths in the content and add a front slash.

Alternatively, try the http://drupal.org/project/pathologic module which tries to be smart about it (or one of the other modules mentioned there).

1
  • I already have the files directory, and some files within. Also, I am able to to access files within the files directory. For example if I went to /sites/default/files/someFile.pdf... it would be able to access it fine. I want to have it so that if I link to a directory within the files directory and that directory does not have an index file... it will display a directory listing of all the files/folders within. Something like: 3.bp.blogspot.com/_rhuioznu6Us/TBmeWAr_G2I/AAAAAAAAAFE/…
    – Smern
    Feb 20, 2015 at 17:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.