Installing using Apache rewrites

Jamie Couture jamie.couture at
Thu Aug 4 17:54:20 CEST 2011

I don't bother with rewrite rules for cgit anymore.  My vhost looks
something like this:

<VirtualHost *:80>

   Alias /cgit-data /var/www/cgit
   ScriptAlias / /var/www/cgi-bin/cgit/



It will inherit the parent DocumentRoot and Directory settings.  If you
want, you can specify them for your own sanity:
DocumentRoot /var/www/cgit

<Directory /var/www/cgit>
Options None
AllowOverride None
Order allow,deny
Allow from all

I don't think there's much apache config help here, but I thought I'd offer
my insight; at the very least, what I have done.

If you want to go crazy, you can even set Expires headers for your images /
css in your config as well, but you can find examples of how to do that in
apache's documentation.

On Thu, Aug 4, 2011 at 11:14 AM, Stephen Paul Weber <
singpolyma at> wrote:

> I'm trying to set cgit up on a Debian system using Apache2 with rewrites.
>  I have this:
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^(?!\/*cgi-bin)\/*(.*) /cgi-bin/cgit.cgi/$1 [PT,L]
> ScriptAlias /cgi-bin/ /usr/local/lib/cgi-bin/cgit/
> <Directory "/usr/local/lib/cgi-bin/cgit/"**>
>        AllowOverride None
>        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>        Order allow,deny
>        Allow from all
> </Directory>
> It's working except for:
> 1) The main page does not work.  No matter what rewrites I add I can't seem
>    to make the main page come up
> 2) The static CSS/image resources are not being loaded, but I think I just
>    need another Alias for them probably
> 3) Links in the app still link to /cgi-bin/cgit.cgi/, which is ugly
> Any thoughts on how to fix these things?
> --
> Stephen Paul Weber, @singpolyma
> See <> for how I prefer to be contacted
> edition right joseph
> ______________________________**_________________
> cgit mailing list
> cgit at

More information about the CGit mailing list