.htaccess file not being read (“Options -Indexes” in .htaccess file not working)

后端 未结 8 1391
梦谈多话
梦谈多话 2020-12-13 12:56

I created an .htaccess file with only the following line:

Options -Indexes

However, the index is still shown for the directory.<

相关标签:
8条回答
  • 2020-12-13 13:46

    As there's no httpd.conf file anymore, what you need to do on a VPS is:

    1. Go to /etc/apache2/sites-enabled/
    2. Do ls to find the file for the website you're looking for
    3. Edit the corresponding file with nano THE_CONF_FILE or with whatever editor you'd like
    4. Change all AllowOverride None values that you see in different <Directory> ... </Directory>s to AllowOverride All
    5. Save the file and close it

    6. Now you need to enable module rewrite by running the command:sudo a2enmod rewrite

    7. And finally to activate the new configuration, you need to run: service apache2 restart

    It'll work like a charm now!

    0 讨论(0)
  • 2020-12-13 13:47

    In case you have

    AllowOverride None
    

    Change that to:

    AllowOverride All
    

    in your httpd.conf or in your default virtualhost file in in /etc/apache2/sites-available/...conf

    0 讨论(0)
提交回复
热议问题