代码之家  ›  专栏  ›  技术社区  ›  Salman Arshad

使用iIRF URL重写引擎时如何获取“原始请求”的URL

  •  3
  • Salman Arshad  · 技术社区  · 15 年前

    我用的是标志性的 IIRF URL Rewriting Engine 在IIS和“花式”URL上是这样的:

    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
    

    这就是为什么我需要原始的URL进行比较。

    1 回复  |  直到 15 年前
        1
  •  6
  •   marapet    13 年前

    U

    IIRF manual

    RewriteRule

    RewriteRule ^/some-function/(\d+)/(.*)$ /some-function.asp?SOME-ID=$1 [I,U,L] 
    

    some-function.asp

    Request.ServerVariables("HTTP_X_REWRITE_URL")