liuhaotian
V2EX  ›  问与答

apache 的 htaccess 如何获取 response header 的值

  •  
  •   liuhaotian · May 29, 2015 · 2001 views
    This topic created in 4028 days ago, the information mentioned may be changed or developed.

    现在需要对一个 response header 进行处理,然后进行 rewrite 的操作。
    查阅资料之后发现跟 http header 有关的是这样一个 RewriteCond % {HTTP:RESPONSE_HEADER} !RESPONSE_VALUE 但是这个在实践中发现似乎是对 REQUEST_HEADER 进行处理的一个方法。
    所以想请教一下,htaccess 是否可以获取 一个页面的 response header。

    我看了 http://httpd.apache.org/docs/2.2/mod/mod_headers.html 发现里面都是对 header 的处理,有没有抓取 header 的方式?


    补充一下,我的问题实际上就是 http://stackoverflow.com/questions/5953096/how-to-display-apaches-default-404-page-in-php

    这里面的方法都是通过跳转来完成的,我在想能不能有一种方法直接在处理的过程中完成,而不需要跳转、附加一些参数。
    我想是不是能够通过 php 抛出一个 response header,然后 apache 抓取后进行 rewrite 到一个空文件实现默认 404 的显示。

    1 replies    2015-05-29 22:33:58 +08:00
    liuhaotian
        1
    liuhaotian  
    OP
       May 29, 2015
    补充一下,我的问题实际上就是 http://stackoverflow.com/questions/5953096/how-to-display-apaches-default-404-page-in-php

    这里面的方法都是通过跳转来完成的,我在想能不能有一种方法直接在处理的过程中完成,而不需要跳转、附加一些参数。
    我想是不是能够通过 php 抛出一个 response header,然后 apache 抓取后进行 rewrite 到一个空文件实现默认 404 的显示。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5519 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 07:07 · PVG 15:07 · LAX 00:07 · JFK 03:07
    ♥ Do have faith in what you're doing.