You are not logged in.

#1 2010-02-18 02:29:49

poorguy
Member
Registered: 2010-01-24
Posts: 26

[SOLVED] cgit, apache, how to rewrite urls?

Hello

I'd like to use cgit like in projects.archlinux.org
all i want is urls like
http://domain/repo.git

however i can only get
http://domain/cgit.cgi/repo.git
i tried virtual-root=/ it seems to work (links are shown as http://domain/repo.git) but i get 404s when i click on them

how can i do that using virtualhost?

Last edited by poorguy (2010-02-19 21:40:52)

Offline

#2 2010-02-18 19:35:38

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

Re: [SOLVED] cgit, apache, how to rewrite urls?

apache has a module to rewrite urls, and it is called mod_rewrite.

HTH.

Offline

#3 2010-02-19 21:40:18

poorguy
Member
Registered: 2010-01-24
Posts: 26

Re: [SOLVED] cgit, apache, how to rewrite urls?

I've did it. Here's how:
Note: you have to put "virtual-root=/" line to /etc/cgitrc

<VirtualHost *:80>                                       
    ServerName git.mydomain.com
    DocumentRoot "/srv/http/cgit"
    DirectoryIndex cgit.cgi
    SetEnv  CGIT_CONFIG   /etc/cgitrc

    <Directory "/srv/http/cgit">
        Options FollowSymlinks ExecCGI
        Allow from all
        AllowOverride all
        Order allow,deny

        <Files cgit.cgi>
            SetHandler cgi-script
        </Files>

        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^.* /cgit.cgi/$0 [L,PT]
    </Directory>

    <Directory "/srv/gitosis/repositories">
        Allow from all
    </Directory>

# To debug rewrite just enable them.
#    RewriteLog /var/log/httpd/rewrite_log
#    RewriteLogLevel 9

    ErrorLog /var/log/httpd/gitweb
</VirtualHost>

Offline

Board footer

Powered by FluxBB