Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to implement a server-relative redirect using existing Apache features?

mod_alias does have a Redirect command, but that one always generates an absolute redirect even if configured like

Redirect /asdf /qwer

Also tried using mod_rewrite like this:

RewriteEngine On
RewriteRule /asdf(.*) /qwer$1 [R,L]

The end result of either of these settings is the same:

HTTP/1.0 302 Found
Location: http://my-host.blah.blah:20085/qwer

But what I really need is:

HTTP/1.0 302 Found
Location: /qwer

--- EDIT ---

Yes, I know this is against RFC spec. But all modern browsers support a relative redirect, and I really need it for a temporary fix.

share|improve this question

That is the way Redirect works; from the manual:

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.

From RFC 2616, section 14.30:

The field value consists of a single absolute URI.

share|improve this answer
It may be an incorrect redirect, but all modern browsers support it. See – RustyX Jul 24 '12 at 9:55
I never said it was incorrect, and his question was whether apache supports it. In short, no :) – adaptr Jul 24 '12 at 9:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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