Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I have this vhost configuration, but the 'Redirect' part does not seems to work. Is it wrong ?

<VirtualHost *:80>
    ProxyRequests Off
    ProxyVia Off
    ProxyPass /
    ProxyPassReverse /
    Redirect permanent /
share|improve this question
What does 'does not seem to be working' mean ? What were you expecting and what is actually happening? If there are error messages what are they? Is there anything interesting in the logs? – Iain Oct 21 '12 at 7:24
up vote 1 down vote accepted

You can't ProxyPass / and redirect /. I guess what you're looking to do is ProxyPass all requests to your local app and if that returns a 404 Not Found then redirect them elsewhere.

Unfortunately, if your app on returns a 404 then this will be returned to your client.

Instead, you need to "un-proxy" the paths that your app will serve. You can do this two ways:

  1. Create ProxyPass rules just for known paths:

For example:

ProxyPass /myapp http://localhost:9091

2. Create exclusions:

For example:

ProxyPass / http://localhost:9091
ProxyPass /notmyapp !
ProxyPass /images !

This will make /notmyapp and /images to be passed through to the redirect

share|improve this answer
Exactly what I needed (except that I had to use "ProxyPassMatch ^/$ !" followed by "RedirectMatch ^/$") – Nison Maël Oct 21 '12 at 20:24

It's possible that mod_alias may not be loaded, as it provides redirect. However, then, you would expect configuration errors in the log.

It's also possible that your ProxyPass and ProxyPassReverse directives are taking precedence. If you intend to redirect, you should either put the rule on the proxied server, or remove the proxy directives. The proxy will pass the 301 redirect.

Additionally, if you redirect / to a subdirectory of itself, you will create a redirect loop. From the docs: any request beginning with URL-path will return a redirect request to the client at the location of the target URL. Additional path information beyond the matched URL-path will be appended to the target URL. This means that when the browser follows up with a request for /web/, it will get a redirect to, and so forth. Consider using RedirectMatch with an anchored regex instead. If by not working you mean that the browser complains of a redirect loop, this is the answer.

share|improve this answer

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.