Getting Cgit Working on a Shared Host With Proper .htaccess
Al
al at ila5.info
Wed Jul 4 08:45:15 CEST 2012
So I posted a request on StackOverflow[0], worded like so:
>
> So I just installed cgit on a shared host. I custom compiled it and use symlinks from $HOME/mydomain-and-public-www-folder.tld/g to $HOME/local/lib/cgit/prod to link $HOME/local/lib/cgit/${git describe} to a build from my updated builds to test the latest version. What does this include?
>
> [sharedhost]$ pwd
> $HOME/local/lib/cgit/prod
> [sharedhost]$ ls
> .htaccess cgit.cgi cgit.css cgit.png lib/
>
> Now, that looks all nice and good on the landing page when I put in https://mydomain.tld/g/ in the browser and I see the pretty cgit interface. When I click any link, I get the proper repos, but all the formatting is gone (the CSS, PNG, and JS files go bye-bye, and all the links are in the form https://mydomain.tld/g/cgit.cgi/randomrepo.git for all the URLs. Of course all the files in the prod path are not working, because the browser looks for things like https://mydomain.tld/g/cgit.cgi/cgit.css instead of the needed https://mydomain.tld/g/cgit.css. Now, this was my basic .htaccess file to get it working.
>
> [sharedhost]$ more .htaccess
> # GIT BEGIN ###########################################################
>
> Options +Indexes +FollowSymLinks +ExecCGI
>
> Action fastcgi-script cgit.cgi
>
> SetEnv HTTP_CGIT_CONFIG /home/username/local/lib/cgit/cgit-conf/cgitrc
>
> RewriteEngine On
> DirectoryIndex cgit.cgi
>
> # GIT END ############################################################
>
> # AUTHENTICATION BEGIN ###############################################
> AuthType Digest
> AuthName "cgitdigestdomain"
> AuthDigestDomain /cgitdigestdomain/
> AuthUserFile /home/username/local/lib/cgit/cgit-conf/.htpasswd
> Require valid-user
> # AUTHENTICATION END ################################################
>
> I have tried a whole bunch of Rewrite patterns recommended like this [1] or that [2]. I am relatively new to more advanced .htaccess rules, so can someone point on how to remove cgit.cgi from the URLs with mod-rewrite and ensure css and png files in the same directory are accessible and QSA/query strings are handled properly. Sorry for the long post. I thought more detail would show why the obvious how-tos on this were not working for me.
>
> [1] Remove 'index.php' from URL with .htaccess
>
> [2] htaccess remove subdirectory from url
I have tried the first recommended solution, amongst many many others
while reading Apache httpd docs, and I feel I must be missing something.
Can someone point out to me how to properly get a .htaccess file to
remove cgit.cgi even with it in the same directory as underlying
component files? I wanted to bundle my compilation of cgit in one place
as I had to change some variables for my shared host, and I wanted to
keep up with development of cgit. Any thoughts?
[0]
http://stackoverflow.com/questions/11316580/htaccess-remove-cgit-cgi-from-path/11317208#11317208
More information about the CGit
mailing list