开发者

Why doesn't .htaccess have any effect?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜