Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

edited for clarification, because all answers/comments where talking about other things then the topic until now

I verified that my apache.conf (Ubuntu) says, that it looks for .htaccess and that it allows .htaccess to override everything:

AccessFileName .htaccess
<Directory /var/www>
AllowOverride All
Options FollowSymlinks

Then I put the following .htaccess (with rights 755) into my /var/www:

order allow, deny
deny from all

Then I restarted my server as root to make sure the config is loaded again and no fileaccess rights can harm my experiment: sudo apache2ctl restart

The result is that he still opens the folder as if there would be no .htaccess. What could be wrong? What else can I check to make sure that it works properly?

edit: I also checked if writing garbage creates an error message and it doesn't!

share|improve this question
If you provide better information, we can give a better answer. Include the result of namei -m /home/erikb/.htusers, and the permissions for both /var/www and your home html dir. – adaptr Dec 2 '11 at 13:46
@adaptr everything is 744 or 755 with erikb/erikb or root/root. Because I started the Apache as root and verified that symlinks work appropriately, there should be no problem in this direction. – erikb Dec 2 '11 at 14:16
Apache does not run as root. – adaptr Dec 2 '11 at 16:58
<Directory />
AllowOverride All

You should not do this; this references the filesystem root.
Instead, only define permissive AllowOverrides from your documentroot on down.
(And, optionally, in your UserDirs)

the server looks for /var/www/ as his webdirectory and inside I linked to another folder in my home directory

To allow symlinking, FollowSymLinks must be set for the source directory (in your case, /var/www)

Instead of these insecure settings, use the following:

<Directory />
  AllowOverride None
  Order allow,deny
  Deny From All

<Directory /var/www>
  AllowOverride All
  Options FollowSymlinks

NOTE that for apache to actually read the symlinked files, they must be accessible; in most cases, this means the directories and files must be world-readable, and the directories world-executable.

share|improve this answer
Of course I will change the folder in <Directory> later on. I just want to make sure that I can do it at all. Also I verified that symlinking works. He starts php and html files from inside my symlinked folder and also shows me the +Indexes stuff. – erikb Dec 2 '11 at 13:44
Seconded, you should put the AllowOverride on your DocumentRoot and not on your entire filesystem, that's bad practice. – Oldskool Dec 2 '11 at 13:44
@Oldskool it is not at all about practise but about making it work. Allowing your system more then it should be allowed can't break anything. I am looking for what is broken now. – erikb Dec 2 '11 at 14:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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