【发布时间】:2011-06-27 13:03:03
【问题描述】:
我有一个在共享主机上安装了 MediaWiki 的个人网站。 Apache 配置使用 PHP 4 处理所有 .php 请求,使用 PHP5 处理所有 .php5 请求。
出于兼容性原因,我需要能够使用 .php 扩展名,但 MediaWiki 仅在 PHP5 上可用。我尝试使用 mod_rewrite 引擎,但我坚持使用规则。
这是当前文件:
DirectoryIndex index.php5
RewriteEngine on
# This rewrites URIs in the form /pages/Article_Name to /index.php5?title=Article_Name.
RewriteCond %{REQUEST_URI} !^/pages/index.php5.*$ [NC]
RewriteRule ^pages/?(.*)$ /index.php5?title=$1 [L]
# This is the broken rule
RewriteCond %{REQUEST_URI} ^index\.php(([^5])(.*))?$ [NC]
RewriteRule ^index\.php(([^5])(.*))?$ /index.php5?$1 [L]
该规则的想法是“将所有内容从 index.php(不跟 '5')重定向到 index.php5”。
有什么想法吗?
编辑:
SetEnv PHP_VER 5
有效,但我仍然对为什么不考虑该规则感兴趣。
【问题讨论】:
标签: .htaccess mod-rewrite url-rewriting