如何获得“最初请求的”使用 IIRF URL 重写引擎时的 URL
我在 IIS 上使用 Iconic 的 IIRF URL 重写引擎,“花哨”的 URL 类似于this:
http://some-website.com/some-function/418/some-keyword-rich-filename.html
此示例 URL 对应于:
http://some-website.com/some-function.asp?SOME-ID=418
现在在 some-function.asp 文件中,我需要知道浏览器请求的页面。我检查了所有 IIS 变量,但无法在其中任何变量中找到值 /some-function/418/some-keyword-rich-filename.html
。
附带说明一下,我需要此信息来将 301 重定向发送到浏览器。例如,如果浏览器请求:
http://some-website.com/some-function/418/index.html
我首先需要将浏览器发送到:
http://some-website.com/some-function/418/some-keyword-rich-filename.html
这就是为什么我需要原始网址进行比较。
I am using Iconic's IIRF URL Rewriting Engine on IIS and the "fancy" URLs are something like this:
http://some-website.com/some-function/418/some-keyword-rich-filename.html
This example URL corresponds to:
http://some-website.com/some-function.asp?SOME-ID=418
Now inside the some-function.asp file I need to know the page that was requested by the browser. I went through all IIS variables but wasn't able to find the value /some-function/418/some-keyword-rich-filename.html
inside any of them.
As a side note, I need this information to send 301 redirect to browsers. E.g. if the browser requests:
http://some-website.com/some-function/418/index.html
I first need to send the browser to:
http://some-website.com/some-function/418/some-keyword-rich-filename.html
And this is why I need the original url for comparison.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 IIRF,这称为unmangling,可以通过使用修饰符
U
来实现。来自 IIRF 手册:
只需将修饰符
U
添加到您想要保留原始 URL 的RewriteRule
即可。例如:然后,在您的页面代码
some-function.asp
中,您可以像这样访问原始URL(经典ASP):For IIRF, this is called unmangling and can be achieved by using the modifier
U
.From the IIRF manual:
Simply add the modifier
U
to theRewriteRule
for which you would like to retain the original url. For example:Then, in the code of your page
some-function.asp
, you may access the original url like this (classic ASP):