如果服务器目录为{AllowOverride:None}且虚拟主机为{AllowOverride:all},则Apache 2.2会忽略.htaccess

如果服务器目录为{AllowOverride:None}且虚拟主机为{AllowOverride:all},则Apache 2.2会忽略.htaccess,apache,.htaccess,slim,tonic,Apache,.htaccess,Slim,Tonic,首先,我读过关于这类话题的每一个问题,但除了其中一个问题,没有人回答 我有一台Apache2.2服务器 Server |-foo |-bar |-piz |-target |-www |-rest_service 我正在/target/REST\u服务上实现一个PHP-REST服务。为此,我正在安装Slim或Tonic框架,但两者都不起作用。我研究了一段时间,我认为问题在于没有从Apache读取de.htaccess文件,所以Apache没有将…/rest\u service/questi

首先,我读过关于这类话题的每一个问题,但除了其中一个问题,没有人回答

我有一台Apache2.2服务器

Server
|-foo
|-bar
|-piz
|-target
 |-www
 |-rest_service
我正在/target/REST\u服务上实现一个PHP-REST服务。为此,我正在安装Slim或Tonic框架,但两者都不起作用。我研究了一段时间,我认为问题在于没有从Apache读取de.htaccess文件,所以Apache没有将…/rest\u service/question/data重定向到…/rest\u service/index.php

httpd.conf

...
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
...
<VirtualHost *:8080>
    DocumentRoot "E:\me\workspace\target\rest_service"  
    #ErrorLog "logs/mysite.com-error.log"
    #CustomLog "logs/mysite.com-access.log" combined
RewriteLog "E:\me\workspace\target\rest_service\rewrite.log"
    <Directory "/target/rest_service">  
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
我只想将每个路径向上(!或向下)../rest\u service/重定向到…/rest\u service/index.php,因此…/rest\u service/users/7正在由…/rest\u service/index.php处理

非常感谢

编辑!-更多信息:

server.log

[Thu May 30 10:20:13 2013] [notice] Child 2820: Starting 64 worker threads.
[Thu May 30 10:20:13 2013] [notice] Child 2820: Starting thread to listen on port 8080.
[Thu May 30 10:20:13 2013] [notice] Child 2820: Starting thread to listen on port 80.
[Thu May 30 10:20:13 2013] [notice] Child 2820: Starting thread to listen on port 8888.
[Thu May 30 10:20:13 2013] [notice] Child 4196: All worker threads have exited.
[Thu May 30 10:20:13 2013] [notice] Child 4196: Child process is exiting
[Thu May 30 10:20:18 2013] [error] [client 127.0.0.1] File does not exist: E:/.../rest_service/users/7
rewrite.log->nothing

编辑-部分解决方案

在开始时,在基本目录(localhost/)中,我有AllowOverride to None,这就是我启用VirtualHost的原因,它有两种不同的配置。(localhost/[foo | bar | piz])和(localhost:port/)


如果我设置了AllowOverride,一切正常!,但是,我想为服务器的其余部分安装一个配置程序。有什么办法吗?

服务器日志中有什么吗?是否启用了
.htaccess
样式文件以及要考虑的注册名称?我用日志结果编辑了这个问题。另外,我在.htaccess中写了一些东西,它没有抛出任何500错误,因此,它让我想到apache忽略了我的htaccess文件。很明显,重写日志中没有任何内容,它在您发布的日志文件中说:“文件不存在”。您希望其中有什么内容?如果您通过浏览器直接请求
.htaccess
文件,会发生什么情况?好的,因此路径是正确的,但显然您的http服务器根本没有配置为使用
.htaccess
样式的文件。因此,要么监视其他名称(检查配置中的AccessFileName指令),要么不编译支持。
[Thu May 30 10:20:13 2013] [notice] Child 2820: Starting 64 worker threads.
[Thu May 30 10:20:13 2013] [notice] Child 2820: Starting thread to listen on port 8080.
[Thu May 30 10:20:13 2013] [notice] Child 2820: Starting thread to listen on port 80.
[Thu May 30 10:20:13 2013] [notice] Child 2820: Starting thread to listen on port 8888.
[Thu May 30 10:20:13 2013] [notice] Child 4196: All worker threads have exited.
[Thu May 30 10:20:13 2013] [notice] Child 4196: Child process is exiting
[Thu May 30 10:20:18 2013] [error] [client 127.0.0.1] File does not exist: E:/.../rest_service/users/7