First option is to edit the file /etc/apache2/sites-avalible/default (i am using ubuntu), then look for the following lines:
-
-
<Directory /var/www/>
-
Options Indexes FollowSymLinks MultiViews
-
AllowOverride None
-
Order allow,deny
-
allow from all
-
# This directive allows us to have apache2’s default start page
-
# in /apache2-default/, but still have / go to the right place
-
#RedirectMatch ^/$ /apache2-default/
-
</Directory>
-
And then take out the word Indexes, then your file will look like
-
-
<Directory /var/www/>
-
Options FollowSymLinks MultiViews
-
AllowOverride None
-
Order allow,deny
-
allow from all
-
# This directive allows us to have apache2’s default start page
-
# in /apache2-default/, but still have / go to the right place
-
#RedirectMatch ^/$ /apache2-default/
-
</Directory>
-
Finally we just reload apache
-
-
sudo /etc/init.d/apache2 restart
-
If you want to use .htaccess, you have two options:
This option will show a forbidden message:
That is a great sharing. I have search for the kind of this guide to make my apache on ubuntu works.
Regards,
Sokhawin