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

I'm trying to add a number of redirects from old domains to new domains which I have done before using simple 301 redirects in my vhost files like:

<VirtualHost *:8080>
  Redirect 301 /

However this isn't working in my vhost file and I am assuming its because of the Varnish server running in front of Apache but not sure how to fix it. The main site, in the same vhost file, is using the same port, ex:

<VirtualHost *:8080>


What am I missing? I've tried working with the varnish configuration file to add the redirects in there but ran into issues -- is that the best option?

share|improve this question
Varnish obeys host headers in caching; it shouldn't cause any problems with this configuration. Can you provide the output of apachectl -S? And maybe also your VCL config? – Shane Madden May 31 '13 at 5:03

I'm still not clear why the apache vhost above wasn't being recognized, perhaps due to something in the varnish vcl file that intercepted it but I was able to solve this eventually by adding a redirect there, following the instructions here

sub vcl_recv {
    if ( ~ "^(www\.)?oldexample\.com$") {
        error 750 "";
    } else if ( ~ "^(www\.)?ancientexample\.com$") {
        error 750 ""

 sub vcl_error {
   if (obj.status == 750) {
       set obj.http.Location = obj.response;
       set obj.status = 302;  
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.