For this you use mod_rewrite.
Example#
In your 000-default file, for apache put
RewriteEngine on RewriteRule ^/gitweb/([a-zA-Z0-9_\-]+\.git)/?(\?.*)?$ /cgi/bin/gitweb.cgi/$1 [PT] RewriteCond %{HTTP_USER_AGENT} !FeedBurner RewriteRule ^/dsawiki/rss\.rdf$ http://feeds.feedburner.com/dsawiki [R] RewriteRule ^/foobar$ http://host.domain.com:8100/admin [R] RewriteRule ^/$ /dsawiki [R] Alias /gitweb /var/path/to/git/repos
Explanations#
RewriteEngine on#
The first line enables mod_rewrite. You also must put it in mods-enabled. See apache docs for this.
Gitweb#
The second line (RewriteRule) allows you to use http://host.domain.com/gitweb/ to point to your repositories. The Alias line at the bottom is also needed.
This line ends in [PT] which stands for "passthrough" (pass through to next handler). It enables post-processing of the output of RewriteRule directives using Alias, ScriptAlias, and Redirect.
RewriteCond HTTP_USER_AGENT#
This line prevents the next line from operating if the HTTP_USER_AGENT is FeedBurner. Basically, if you subscribe to my blog, you actually subscribe through FeedBurner. I of course don't want FeedBurner getting forwarded back to itself.
RewriteRule dsawiki/rss#
If you are not FeedBurner, then any requests to /dsawiki/rss.rdf get forwarded to FeedBurner. This ends in [R] because that's the end of the rule.
RewriteRule /foobar#
Going to http://host.mydomain.com/foobar will redirect to http://host.domain.com:8100.admin. This is so people can go to a meaningful url instead of a port and /admin to see a Django admin panel.
RewriteRule /dsawiki#
This line forwards requests from http://domain.com to http://domain.com/dsawiki
Networking