Search code examples
apachemod-rewriteviewvc

rancid VIEWVC apache rewrite rule, CGI page incorrectly shown


i configured rancid VIEWVC web page, CentOS 8

<VirtualHost *:80>
        DocumentRoot /var/www
        ScriptAlias /cgi-bin/ "/var/www/cgi-bin"
        ScriptAlias /viewvc /var/www/cgi-bin/viewvc.cgi
        ScriptAlias /query /var/www/cgi-bin/query.cgi
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

It works fine when accessing http://ip/viewvc

I want to access to VIEWVC page by http://ip

so i modified conf file:

<VirtualHost *:80>
        DocumentRoot /var/www
        ScriptAlias /cgi-bin/ "/var/www/cgi-bin"
        ScriptAlias /viewvc /var/www/cgi-bin/viewvc.cgi
        ScriptAlias /query /var/www/cgi-bin/query.cgi
        RewriteEngine on
        RewriteRule (.*) /var/www/cgi-bin/viewvc.cgi
<Directory "/var/www/cgi-bin">
    AllowOverride All
    Options +ExecCGI -Indexes
    AddHandler cgi-script cgi py
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

with redirection, page is "partially" loaded

http://IP

enter image description here

Without redirection all works fine

http:/ip/viewvc

enter image description here


Solution

  • Try at least RewriteRule ^/$ instead otherwise any static assets will be rewritten to the CGI too.