mod_rewrite的htaccess的问题 [英] Mod_rewrite htaccess question

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

问题描述

我怎么能采取如 http://example.com/page.php?2342

和把它变成

http://example.com/page/?2342

或者是不可能的?

推荐答案

您不需要mod_rewrite的了点。您可以使用多视图

You don't need mod_rewrite for that. You can use MultiViews.

Options MultiViews

除了你的其他选择。您需要mod_negotiation模块在服务器上启用。

in addition to your other options. You need mod_negotiation enabled in your server.

从文档:

多视图的作用是作为   如下:如果服务器接收到一个   要求/一些/ DIR /富,如果   /一些/目录已经多视图启用,并   /一些/目录/ foo的不存在,那么   服务器读取目录中寻找   文件名为​​foo。*,并有效   假货一个类型的地图,名字全部   这些文件,分配给他们同样的   媒体类型和内容的编码它   本来如果客户曾要求   他们的名字之一。然后选择   以客户的最佳匹配   要求。

The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements.

多视图可能也适用于搜索   对于命名的文件   DirectoryIndex指令,如果   服务器尝试索引目录。   如果配置文件指定

MultiViews may also apply to searches for the file named by the DirectoryIndex directive, if the server is trying to index a directory. If the configuration files specify

DirectoryIndex的指数则服务器   index.html,然后将之间​​的仲裁   index.html3如果两者都present。如果   也不是present,并查找index.cgi是   在那里,服务器将运行它。

DirectoryIndex index then the server will arbitrate between index.html and index.html3 if both are present. If neither are present, and index.cgi is there, the server will run it.

如果其中的一个文件中读取时   该目录不具有   扩展名mod_mime承认   指定的字符集,内容类型,   语言,或编码,然后将结果   取决于设定   MultiViewsMatch指令。本   指令确定是否处理,   过滤器,以及其它分机可以类型   参加多视图谈判。

If one of the files found when reading the directory does not have an extension recognized by mod_mime to designate its Charset, Content-Type, Language, or Encoding, then the result depends on the setting of the MultiViewsMatch directive. This directive determines whether handlers, filters, and other extension types can participate in MultiViews negotiation.

这篇关于mod_rewrite的htaccess的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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