Apache and incomplete redirection messages

As part of moving my site around, I needed a bunch of redirects so that http://enc.com.au/docs/linuxload.html now becomes because its now controlled by [Wordpress][]. so I used the [RedirectPermanent][] feature of [mod_alias][2.2 mod_alias] to do it with lines like:

RedirectPermanent /docs/linuxload.html /2010/07/manually_calculating_process_times/

So you come in on /docs/linuxload.html and redirect to the blog entry, simple really! It actually works, kinda, but the log files fill with things like:

[Fri Mar 04 14:40:17 2011] [warn] [client 172.16.242.1] incomplete redirection target of '/2010/07/manually_calculating_process_times/' for URI '/docs/linuxload.html' modified to 'http://enc.com.au/2010/07/manually_calculating_process_times/

What is going on? Why won’t Apache just be quiet and be happy? The reason is in the Redirect Directive documentation on the [2.0 mod_alias][] page:

> Also, URL-path must be a fully qualified URL, not a relative path, even when used with .htaccess files or inside of sections.

But I’m running Apache 2.2 and the [2.2 mod_alias][] page says:
> The new URL should be an absolute URL beginning with a scheme and hostname, but a URL-path beginning with a slash may also be used, in which case the scheme and hostname of the current server will be added.

That’s it, you two choices:

* Use relative urls and have Apache complain
* Use absolute urls and have a happy Apache

Changing the above config snippet to use absolute paths fixed it.

RedirectPermanent /docs/linuxload.html http://enc.com.au/2010/07/manually_calculating_process_times/

[2.2 mod_alias]: http://httpd.apache.org/docs/2.2/mod/mod_alias.html
[2.0 mod_alias]: http://httpd.apache.org/docs/2.0/mod/mod_alias.html
[RedirectPermanent]: http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectpermanent
[Wordpress]: http://www.wordpress.org/

2 thoughts on “Apache and incomplete redirection messages

  1. FWIW, that’s been changed to appear only at LogLevel Debug in Apache 2.3 and trunk. Having it at Warning level in 2.2.x is a buglet.

Leave a Reply

Your email address will not be published. Required fields are marked *