For the past few days I've been trying to allow visitors to browse the directories on my server (Apache 2.0.48), for example a /pictures directory. I kept receiving the 403 Forbidden problem that seemed so common on these forums. I finally fixed the problem, but I still don't really know what I did to fix it. Let me start with what I did to get there.
I tried all the tips I could find on this site and others such as doing "chmod 755" on the /srv/www/htdocs/pictures directory and in fact I think I ended up doing it on
every directory, but that didn't work.
I also tried adding a few lines in the .conf file that read...
Code:
<Directory "/srv/www/htdocs/pictures">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
That didn't work either, still gave me the 403 Forbidden error. I should mention that I could access a file based on a direct link, but not general directory browsing.
Next I tried using a virtual host as...
Code:
<VirtualHost shosterman.dyndns.org>
DocumentRoot "/srv/www/htdocs/"
Options Indexes
</VirtualHost>
That didn't work either, but then again I'm not exactly sure what a virtual host does.
I don't have an .htaccess file so I skipped most of the how-to's that involved that.
These settings were default in there already and I spent several hours toying around with different configurations, but never succeeded.
Code:
<Directory "/srv/www/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
So finally, what I did to get it working was I added this code in...
Code:
<Location />
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
</Location>
All this time I have never seen the word
Location used, I only tried it after a friend suggested changing the word
Directory to
Location. He was as surprised as I was that it worked because he said these were supposed to be interchangeable.
After checking the apache website for
Location, I found
this explanation, but it doesn't help me understand why it worked and
Directory did not.
Anyway, I was looking for some help why making that switch solved my problem. More importantly though, I'm hoping this might help out others stuck with the same problem.
Stephen