问题描述
我有一个目录中的.htaccess文件,但没有任何效果(不管我把它)。
我的apache2.conf文件包含
AccessFileName的.htaccess
<目录的/ var / www的>
设置AllowOverride所有
< /目录>
这已经说了 AccessFileName的.htaccess
,但我添加了目录标记自己,因此我不知道这是否是正确的。
感谢您的详细信息任何意见和要求。
我的.htaccess的内容(现在)
选项+了FollowSymLinks
RewriteEngine叙述上
重写规则。* page.php?ARG = $ 0个
您是Debian的,根据你的标签。默认的网站,至少在莱尼在的Apache2的默认配置,可以在/ etc定义/ Apache2的/站点可用/ 000默认。此缺省值的AllowOverride无
中部分为/ var / www目录。所以,这可能是压倒一切的apache2.conf。
当然,你需要确保该网站已启用。如果/ etc / apache2的/站点启用/ 000默认存在且是一个符号链接指向到/ etc / apache2的/站点可用/ 000默认,那么该网站已启用。该规范的方法,以使这样的网站,如根, a2ensite 000默认
。
最后,认识到,如果你有机会到主配置,性能方面的原因,你应该使用主配置配置您的网站(或/ etc中的站点配置/ Apache2的/站点可用的),而不是在.htaccess。请参阅http://httpd.apache.org/docs/2.2/howto/htaccess.html对于进一步的解释。
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
<Directory "/var/www">
AllowOverride All
</Directory>
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.
My .htaccess content (for now)
Options +FollowSymlinks
RewriteEngine on
RewriteRule .* page.php?arg=$0
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.
这篇关于为什么不的.htaccess有什么影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!