0

我正在使用带有 suPHP 0.6.2 和 PHP 5.2.6 的 Apache 2.2.6,并且我正在尝试使用别名来通过 PHP 脚本路由某个 URL 上的所有请求。我希望对 /test 的所有请求都通过 index.php。在 Apache 虚拟主机配置中,我设置了 Alias Alias /test /index.php。index.php 只是一个包含以下内容的虚拟脚本:

<?php
phpinfo();
?>

请求http://localhost/index.php可以工作并给出预期的输出,但是请求http://localhost/test没有,并且给我一个 403 错误,error.log 包含以下内容:

[Wed Jan 27 17:13:19 2010] [error] [client 127.0.0.1] client denied by server configuration: /index.php

我的别名有什么问题?

编辑: 我几乎忘了提到通过 mod_rewrite 将 /test 重写为 /index.php 也可以,但是我想尽可能避免在我的生产服务器上使用 mod_rewrite。

4

1 回答 1

0

Alias 需要一个绝对路径,所以Alias /test /var/www/index.php让它工作。

于 2010-01-27T16:44:22.273 回答