Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would probably do this with PHP and not Apache, but that is just my own preference. If the call to <code>header()</code> isn't working, it's likely because you have whitespace outside of PHP tags somewhere before your call to <code>header()</code>. Take note of this in the <a href="http://us.php.net/manual/en/function.header.php" rel="nofollow">PHP manual</a>:</p> <blockquote> <p>Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.</p> </blockquote> <p>If you <strong>must</strong> do this with Apache, mod_headers doesn't seem suited. mod_headers can only set headers based on conditions of whether a request is successful (2xx) or for any request. See <a href="http://httpd.apache.org/docs/2.0/mod/mod_headers.html#header" rel="nofollow">Header directive</a>.</p> <p>Instead, I think it could be done by a combination of using <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html" rel="nofollow">mod_rewrite</a> and <a href="http://httpd.apache.org/docs/2.0/mod/mod_asis.html" rel="nofollow">mod_asis</a>. I don't have a particular "recipe" for this, but the idea would be to check to see if a request is authorized with mod_rewrite, and if it's not authorized, rewrite/redirect the request URI to an .asis document that contains the header info that you want to send back.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload