On a local dev server, I have an Apache conf for a website like so
<VirtualHost *:80>
ServerAdmin no-reply@localhost
ServerName sandbox.mysite.internal
DocumentRoot /var/www/vhosts/sandbox/mysite
ErrorLog logs/sandbox/mysite-error.log
CustomLog logs/sandbox/mysite-access.log common
</VirtualHost>
If I visit the following address (there is no index.php or index.html)
http://sandbox.mysite.internal
I get the Apache CentOS test page
If I visit a subdirectory like
http://sandbox.mysite.internal/test/
I get a 403 Forbidden
error. So I add the following .htaccess
here:
/var/www/vhosts/sandbox/mysite/test/.htaccess
Content:
Options +Indexes
Now when I visit:
http://sandbox.mysite.internal/test/
I still get 403 Forbidden.
How do I make the directory index show up?
I always thought .htaccess
directives override any httpd.conf
directives. But am I wrong about that? Is there some setting in my httpd.conf
that is making my .htaccess
directive be ignored?
Best Answer
Sure,
AllowOverride None
would prevent.htaccess
files from functioning. But, why use them at all? Apache's recommendation is to never use.htaccess
unless you are unable to access the main configuration.Try this, instead:
If that doesn't work, have a look at Apache's error log; you may have something wrong with your file/directory permissions, for example.