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 am running apache2 on debian etch, with multiple virtual hosts.

I want to redirect so that http://git.example.com goes to http://git.example.com/git/

Should be really simple, but google isn't quite cutting it. I've tried the Redirect and Rewrite stuff and they don't quite seem to do what I want ...

share|improve this question
    
There are many ways you could approach this, but what is exactly what you are trying to accomplish? – WerkkreW May 19 '09 at 17:24
up vote 69 down vote accepted

Feel a bit silly - a bit more googling turned up the answer I was after:

RedirectMatch ^/$ /git/

Basically redirecting the root, and only the root.

share|improve this answer

You've got the correct answer there with the redirect. You have to be careful when redirecting everything to somewhere else, since you can get recursive redirects there. This happens if you want to put up a maintenance page.

share|improve this answer
3  
Indeed. Redirect / /git/ results in recursive fireworks. – davor May 9 '15 at 20:51

You can use Redirect directive.

<Directory />
   Redirect permanent / http://git.example.com/git/
   ...
</Directory>
share|improve this answer

Your Answer

 
discard

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.