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 want, to go to a specific directory, /var/www/cakephp/dev/webroot. Here's my apache2 conf file:

<VirtualHost *:80>
        Redirect permanent / /var/www/cakephp/dev/webroot

I keep getting successive 301 Moved permanently responses (until the server stops sending them, or is it the browser stops requesting them?)

GET webroot:
GET webroot:
[...] 21 requests later (seriously):
GET webroot:

I found these responses via firebug. Anyone know what the problem could be? Thanks.

share|improve this question
up vote 2 down vote accepted

Instead of a Redirect, isn't what you need a DocumentRoot?

What you're doing here is sending a redirect back to the client. Therefore, what's happening is that Apache's prepending the name of the current VHost onto the redirect target string, and sending:


Of course, when that hits, it finds the VHost, and lo and behold! there's a Redirect in there that applies to this request. So it happily sends you to, which works out to:


Make sense now? At any rate, what you need is:

<VirtualHost *:80>
    DocumentRoot /var/www/cakephp/dev/webroot
    <Directory /var/www/cakephp/dev/webroot>
        Order allow,deny
        Allow from all
        Deny from none

The section is optional; add it only if you get 403's when you try to use the site with the new DocumentRoot directive in place.

share|improve this answer
You are smart, my friend. Thanks! – ash Jun 26 '10 at 3:33

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.