开发者

Why doesn't .htaccess have any effect?

开发者 https://www.devze.com 2023-01-23 14:02 出处:网络
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

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

精彩评论

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