httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt <>
Subject [users@httpd] Using Redirect directive without specifying scheme or host...
Date Tue, 26 Jun 2007 20:10:30 GMT
I'm trying to configure Apache to redirect from sort of a shortcut path 
name to a longer path, so that, for example, all requests to will be redirected to  The following 
directive accomplishes this:

    Redirect /source/

However, if I do that then the URL scheme, hostname, and port (if 
specified) that the client used to access the server will be 
unconditionally replaced with  I'd like to keep 
those first three components of the URL untouched, and just have that 
one directory name get changed.  So, in addition to being redirected to, 
http://foo/source/directory/file.ext would get redirected to 
http://foo/destination/directory/file.ext, would get redirected to, and so on.  I've not yet 
gotten SSL configured on my server, but if the URL being redirected to 
would use the same protocol as the URL being redirected from then that 
would be good, too.

According to the mod_alias documentation 
<>, when 
using the Redirect directive "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 sounds like it does what I want.  
However, if I use this:

    Redirect /source/ /destination/

...then when I try to restart Apache it indicates that there is a syntax 
error and states "Redirect to non-URL".  I've tried several variations 
but they all give me the same error.

I know I could probably use mod_rewrite to accomplish this but that 
seems like a heavyweight solution and an awful lot of work, especially 
considering that, at least according to the documentation, Redirect 
already does exactly what I want.  The Alias directive would probably do 
the trick, too, but I specifically want this to be a client-side 
redirect, not a server-side redirect.  So, is this an error in the 
documentation, or am I not understanding the syntax it's expecting when 
it says "a URL-path beginning with a slash"?

I'm running Apache on Ubuntu Server 7.04 (Feisty Fawn), which, according 
to Ubuntu's package manager (Aptitude), is version 2.2.3-3.2b.  I know 
that the latest version of Apache is 2.2.4, however it's not yet 
available through Aptitude.  I didn't see any references to this issue 
in the changelog for 2.2.4, but could not running the latest version of 
Apache be the reason for this problem as well?

Thanks for the help.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message