Apache 虚拟主机中的“重写引擎打开”不工作

Apache 虚拟主机中的“重写引擎打开”不工作,apache,.htaccess,mod-rewrite,virtualhost,Apache,.htaccess,Mod Rewrite,Virtualhost,这是我的虚拟主机条目 版本:Apache/2.2.15 Unix <VirtualHost *:80> ServerName web1.net ServerAlias www.web1.net ServerAdmin webmaster@web1.net DirectoryIndex index.html index.php LogLevel warn ErrorLog /var/log/httpd/web1.net_error_

这是我的虚拟主机条目

版本:Apache/2.2.15 Unix

<VirtualHost *:80>
    ServerName web1.net
    ServerAlias www.web1.net

    ServerAdmin webmaster@web1.net

    DirectoryIndex index.html index.php

    LogLevel warn
    ErrorLog /var/log/httpd/web1.net_error_log
    CustomLog /var/log/httpd/web1.net_access_log combined

    DocumentRoot /web/web1.net/htdocs

    <Directory "/web/web1.net/htdocs">
        Options Indexes FollowSymLinks Includes ExecCGI
        Order allow,deny
        Allow from all
        AllowOverride All

        RewriteEngine On    #This is not working
    </Directory>

</VirtualHost>
当我将相同的重写引擎放在.htaccess文件中时,它开始工作,为什么我需要将它放在.htaccess中,而它存在于虚拟主机中

我是否需要在Apache配置中进行任何其他更改?

如果要启用重写,需要在每个目录的.htaccess中启用RewriteEngine。简言之:

从服务器配置上重写引擎对DocumentRoot/.htaccess无效 DocumentRoot/.htaccess中的RewriteEngine on不会对任何/subdir/.htaccess生效
我以前做过这个设置,它工作正常。我正在使用相同的配置部署相同的应用程序。
RewriteEngine on   # It works.
#abc5
RewriteCond %{HTTP_HOST} ^example\.org$ [NC]
RewriteRule .* http://www.example.com