== Modern versions of Apache and _Redirect_ Our main web server is currently running Ubuntu 8.04. For reasons beyond the scope of this entry, we want to upgrade it to Ubuntu 10.04, so today I did a test install, which wound up exploding with a bunch of log messages that looked like: > _[...] .htaccess: Redirect: invalid first argument (of three)_ Internet searches will give you inconclusive and somewhat confused answers; it doesn't help that Apache doesn't report a line number, and that _Redirect_ can validly take three arguments. What you have probably done is written a Redirect that looks like this: > _Redirect /a/path !http://some.where/ [L]_ This is a superstition. _Redirect_ doesn't take a flags argument at the end; only _RewriteRule_ does. It used to be harmless to put flags on the end anyways, so people did it for various reasons (mistaken belief that it was required, laziness, forgetfulness, etc). Modern versions of Apache are more picky about _Redirect_ directives and so choke on this with the error message you see here. (This error is especially fun in a _.htaccess_, because if there are any problems with a _.htaccess_ Apache locks you out of the directory it's in. As it happened, some of our crucial _.htaccess_ files had this problem.) === Sidebar: the Apache versions involved To save you looking this up: Ubuntu 10.04 has Apache 2.2.16 and Ubuntu 8.04 has Apache 2.2.8. The pickiness was apparently introduced in [[this change http://mail-archives.apache.org/mod_mbox/httpd-cvs/200907.mbox/%3C20090710123018.42AE02388876@eris.apache.org%3E]] in July of 2009, and it appears that this then appeared in 2.2.12 (per the [[CHANGES_2.2|]] file, which lists this PR as one of the 2.2.12 changes). Before the change, Apache would just ignore the third argument of a three-argument _Redirect_ if it couldn't interpret the first argument as a redirection status. After the change, it considers it an error. Looking at the change, it's hard to criticize the Apache people for it; the previous behavior was a great way to have mistakes compound themselves.