Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to forward all requests to a particular hostname to a specific URL.

My virtual host entry looks like:

<VirtualHost *:80>
    ServerName test.example.com
    RedirectPermanent / http://another.example.com/path/

This works for anyone going to http://test.example.com. I am trying to add an error handler:

ErrorDocument 404 http://another.example.com/path/

so that any and all requests go to the same server. The problem is that if I request http://test.example.com/foo then the end result is a request to http://another.example.com/path/foo. I tried setting the error document to http://another.example.com/path? but it ignored the ? and still redirected to /path/foo

How do I prevent the path from being added to the error URL?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Maybe you just need RedirectMatch permanent ^ http://another.example.com/path/ instead of RedirectPermanent or ErrorDocument.

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.