To fulfil the requirements of the PubSubHubbub 0.4 spec, I have to send a rel=self header for each file.

I'm now trying to do that with Apache's mod_headers and environment variables:

Header append Link '<http://example.org%{REQUEST_URI}e>; rel="self"'

This works as long the file is processed by PHP, but does not for static files (like *.htm) which are not processed by mod_php or any CGI process.

There does not seem to be a way to get a list of all current Apache environment variables, so I can't check which ones are actually available.

So my question is: How can I access the relative path of the current requested URL in the Header append directive?

Happens on Debian 7 with Apache 2.2.22-13+deb7u4.

  • I'm seeing this also, it works for .php files, it works for static files that don't exist, but not for static files that DO exist.. odd indeed! I'm actually seeing "(null)" for static's that do exist. Link <http://server.org(null)> rel="self" – Grizly Jun 2 '15 at 7:02

Nick Kew on the apache mailing list gave me an answer:

REQUEST_URI is a CGI environment variable. The variables are not avaiable for performance reasons if CGI is not used for a file.


You should be able to use many of the Server Variables that are available to directives such as RewriteCond (http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond)

Enabling mod_rewrite and adding "RewriteEngine on"; that should cause the variable to be populated.

If that isn't enough to populate the server variable you need, then you should also post the httpd configuration and OS details (eg. a lot of vendors versions of httpd 2.2, such as Red Hat's, have a lot of back-ports).

  • RewriteEngine is already on. – cweiske Jun 6 '15 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.