Using Redirect directive without specifying scheme or host...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 http://foo.example.com/source/directory/file.ext will be redirected to http://foo.example.com/destination/directory/file.ext. The following directive accomplishes this:

   Redirect /source/ http://foo.example.com/destination/

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 http://foo.example.com. 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 http://foo.example.com/source/directory/file.ext being redirected to http://foo.example.com/destination/directory/file.ext, http://foo/source/directory/file.ext would get redirected to http://foo/destination/directory/file.ext, http://192.168.1.1/source/directory/file.ext would get redirected to http://192.168.1.1/source/directory/file.ext, 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 <http://httpd.apache.org/docs/2.2/mod/mod_alias.html#Redirect>, 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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux