Why doesn't .htaccess have any effect?

后端 未结 1 537
予麋鹿
予麋鹿 2020-12-30 04:07

I have a .htaccess file in a directory, but it has no effect (no matter what I put in it).

My apache2.conf file contains

AccessFileName .htaccess

&l         


        
相关标签:
1条回答
  • 2020-12-30 04:42

    You're on Debian, according to your tags. The default site, at least on Lenny in its default configuration of apache2, is defined in /etc/apache2/sites-available/000-default. This default has AllowOverride None in the section for the /var/www directory. So, that could be overriding your apache2.conf.

    Of course, you would need to ensure that the site is enabled. If /etc/apache2/sites-enabled/000-default exists and is a symlink pointing to /etc/apache2/sites-available/000-default, then the site is enabled. The canonical way to enable such a site is, as root, a2ensite 000-default.

    Finally, realize that if you have access to the main configuration, for performance reasons, you should configure your site using the main configuration (or the site configurations in /etc/apache2/sites-available) rather than in .htaccess. See http://httpd.apache.org/docs/2.2/howto/htaccess.html for further explanation.

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