1

首先,我已经阅读了有关此类主题的所有问题,但除了其中一个之外,没有得到答复。

我有一个 Apache 2.2 服务器

Server
|-foo
|-bar
|-piz
|-target
 |-www
 |-rest_service

我正在 /target/rest_service 上实现 PHP-REST 服务。为此,我正在安装 Slim 或 Tonic Framework,但它们都不起作用。我研究了一段时间,我认为问题是因为没有从 Apache 读取 de .htaccess 文件,所以,Apache 不会将 .../rest_service/question/data 重定向到 .../rest_service/索引.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>

"E:\me\workspace\target\rest_service\" 上的 .htaccess(来自 Slim 框架)

RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
#RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

我只想将每条路径向上(!或以下)重定向 .../rest_service/ 到 .../rest_service/index.php 所以 .../rest_service/users/7 正在由 .../rest_service/index 处理.php

非常感谢

编辑!- 更多信息:

服务器日志

[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 -> 什么都没有!

编辑 - 部分解决方案!

在起点,在基本目录 (localhost/),我将AllowOverride 设置为 None,这就是我启用 VirtualHost 以拥有两个不同配置的原因。(localhost/[ foo | bar | piz ]) 和 (localhost:port/)。

如果我设置 AllowOverride all IT WORKS!,但是,我想为服务器的其余部分设置一个配置设备。有什么办法吗?

4

0 回答 0