此前不久有人问,但它仍然在那里,所以这里的一个答案:
规则已.asp的在里面,所以它正在寻找这个网址。由于您只需要产品名称,请尝试此操作,而不在规则中使用.asp。
这是下ISAPI_Rewrite V3:在映射文件
RewriteMap mapfile txt:mapfile.txt [NC]
RewriteRule /([^/]+) /Products.asp?Prod=${mapfile:$1} [NC,QSA,L]
使用[NC]让你有law 2
无需担心的情况。 (这是在3.1.0.62版本和更新,这是很久以前)。
v3处理规则外的参数,所以规则不需要寻找?
。
QSA会将您的Prod参数附加到任何传入参数。由于你的规则在?
停止,我假设你也想处理传入的参数。所以参数会存活。
这保持你在(第一斜线后)斜线停止的规则,所以一切从一个斜线起将进行匹配被忽略,从结果中删除。
因此,这将重写URL是这样的:
/LAW to /Products.asp?Prod=2
/lAw to /Products.asp?Prod=2
/LAW?abc=123 to /Products.asp?Prod=2&abc=123
/LAW/ to /Products.asp?Prod=2
/LAW/?abc=123 to /Products.asp?Prod=2&abc=123 (slash is dropped, but parameters survive)
/LAW/morestuff to /Products.asp?Prod=2 (/morestuff is dropped)
/LAW/morestuff?abc=123 to /Products.asp?Prod=2&abc=123 (/morestuff is dropped, but the parameters survive)
原始参数是追加到规则替代参数(S)的结束,从文件确定,从日志文件中进行验证。
你真的尝试了什么网址? – Gumbo 2009-08-09 08:39:00
你好,我 试图让 http://www.mydomain.com/products.asp?prod=2 到 http://www.mydomain.com/LAW 或 HTTP://www.mydomain .COM /产品-LAW – user153230 2009-08-09 14:29:54