一些重写PHP的规则时,Apache的mod_rewrite模块被禁止 [英] Something rewrites rules for php when Apache mod_rewrite module is disabled

查看:161
本文介绍了一些重写PHP的规则时,Apache的mod_rewrite模块被禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行以下网址:

http://localsite/index.php/foo/bar

的index.php被执行,并输出可变

index.php is executed and outputs variable:

$_SERVER[SCRIPT_FILENAME] = E:/path/to/file/index.php

mod_rewrite的Apache中是禁用的。

mod_rewrite in Apache is disabled.

谁重写规则?结果还是发生了什么?

Who rewrites the rule?
Or what happens?

如何的index.php被发现?为什么apache的决定来运行它?

How index.php is found? Why apache decided to run it?

我的配置:
Windows Vista中,阿帕奇阿帕奇/ 2.2.14(的Win32)PHP / 5.3.1(用PHP模块)。

My configuration: Windows Vista, Apache Apache/2.2.14 (Win32) PHP/5.3.1 (with php module).

(事实上,问题是规则的mod_rewrite之前实际改写 - 这是启用了mod_rewrite时,这会导致的RewriteCond%{} REQUEST_FILENAME -f 永远是假的! ,因为 /富/条之前修剪的RewriteCond )。

(Indeed the problem is the rule is actually rewritten before mod_rewrite - this is when mod_rewrite is enabled. This causes that RewriteCond %{REQUEST_FILENAME} !-f is always false, because /foo/bar is trimmed before RewriteCond).

推荐答案

这是由的 的AcceptPathInfo 的Apache。

This is caused by the AcceptPathInfo Apache directive.

它把一切都交给

http://localsite/index.php

作为资源,并提出

as the resource, and puts

/foo/bar

$ _ SERVER [PATH_INFO] 变量。

它有时被用来作为一个穷人的URL重写时的mod_rewrite 不可用 - 与在正常配置,必须有一个<$ C $下行C>的.php 某处的URL。

It's sometimes used as a poor man's URL rewriter when mod_rewrite isn't available - with the downside that in a normal configuration, there has to be a .php somewhere in the URL.

您的选择是关闭这个功能,或者使用不同的URL - 根据您的情况

Your options are to turn this off, or to use a different URL - depending on your situation.

这篇关于一些重写PHP的规则时,Apache的mod_rewrite模块被禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆