mod_rewrite的没有通过查询字符串 [英] mod_rewrite not passing querystring

查看:140
本文介绍了mod_rewrite的没有通过查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP的CGI安装了Apache2的服务器来运行PHP脚本 里面我目录我有的.htaccess 文件如下:

I have an apache2 server installed with PHP CGI to run php scripts inside one of my directories I have .htaccess file with the following:

RewriteEngine On
RewriteRule ^article\/(\d+)\/?$ article.php?id=$1 [NC,QSA]

进入URI时,如 http://www.mysite.com/article/132/ 重写使得重定向,但里面的的文章。 PHP 我不能读 $ _ GET [身份证] (后续代码var_dump 从<$ C C $> $ _ GET / $ _ REQUEST 导致空数组

when entering URI such as http://www.mysite.com/article/132/ the rewrite makes the redirect but inside article.php I can't read $_GET["id"] (var_dump from $_GET/$_REQUEST results in empty array

在另一台服务器我已经跟Apache mod_php的 - 一切正常。

in another server I have which has apache with mod_php - everything works fine.

我不是100%肯定的CGI是什么原因 - 但我有一个很好的理由假定这样

I'm not 100% sure that the CGI is the reason for that - but I have a good reason for assuming so

谢谢!

推荐答案

这听起来像含糊搞乱mod_negotiation模块事情时,你不希望它。尝试添加到您的htaccess文件:

This sounds vaguely like mod_negotiation messing things up when you don't want it to. Try adding this to your htaccess file:

Options -Multiviews

多视​​图选项打开的东西mod_negotiation模块它试图猜测资源的请求是经过。当它看到URI /条/某事,然后它会看到有一个文件 /article.php ,它假定你的意思 /article.php/something 和供应,截至彻底,完全绕过了mod_rewrite的。

The Multiviews options turns on something in mod_negotiation which tries to guess what resource a request is after. When it sees the URI /article/something and then it sees that there is a file /article.php, it assumes that you meant /article.php/something and serves that up outright, completely bypassing mod_rewrite.

这篇关于mod_rewrite的没有通过查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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