问题描述
我的目录中有一个.htaccess文件,但它没有任何效果(不管我放在哪里)。
I have a .htaccess file in a directory, but it has no effect (no matter what I put in it).
我的apache2.conf文件包含
My apache2.conf file contains
AccessFileName .htaccess
<Directory "/var/www">
AllowOverride All
</Directory>
它已经说过 AccessFileName .htaccess
但是自己添加了目录标签,因此我不知道是否正确。
It already said AccessFileName .htaccess
but I added the Directory tag myself, thus I'm not sure if it's correct.
感谢任何建议和请求获取更多信息。
Thanks for any advice and requests for more information.
我的.htaccess内容(现在)
My .htaccess content (for now)
Options +FollowSymlinks
RewriteEngine on
RewriteRule .* page.php?arg=$0
推荐答案
根据您的标签,您在Debian。默认站点,至少在Lenny的默认配置中apache2,在/ etc / apache2 / sites-available / 000-default中定义。该默认值在/ var / www目录的部分中为 AllowOverride None
。因此,这可能会覆盖您的apache2.conf。
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.
当然,您需要确保该站点已启用。如果/ etc / apache2 / sites-enabled / 000-default存在,并且是指向/ etc / apache2 / sites-available / 000-default的符号链接,则会启用该站点。启用此类网站的规范方式是以root用户身份, a2ensite 000-default
。
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
.
最后,意识到如果您有权访问主配置,出于性能原因,您应该使用主配置(或/ etc / apache2 / sites-available中的站点配置)而不是.htaccess配置站点。请参阅进一步说明。
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.
这篇关于为什么没有.htaccess有什么影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!