The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
# ------------------------------------------------------------------------------
# Port 80

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    ServerName pass.cpantesters.org
    ServerAdmin barbie@missbarbell.co.uk
    DocumentRoot /var/www/cpanreps/html/stats
    RewriteEngine on
    RewriteRule ^/dist/(\w)(.*)$                /distro/$1/$1$2 [R=301]
    ErrorLog /var/www/logs/cpanpass-error.log
    CustomLog /var/www/logs/cpanpass-access.log common
</VirtualHost>

<VirtualHost 127.0.0.1:80>
    ServerName static.cpantesters.org
    ServerAdmin barbie@missbarbell.co.uk
    DocumentRoot /var/www/cpanreps/html/static
    RewriteEngine on

    RewriteRule ^(/(author|distro)/[A-Za-z]/[-\w.]+\.(rss|ya?ml))$	http://www.cpantesters.org$1 [R=301,L]

    RewriteRule ^/stats/?$        		http://pass.cpantesters.org [R=301,L]
    RewriteRule ^/stats(/.*)?      		http://pass.cpantesters.org$1 [R=301,L]

    RewriteRule ^/(show|dist|distro|author)/?$  / [R=301]
    RewriteRule ^/show/(\w)(.*)$                /distro/$1/$1$2 [R=301]
    RewriteRule ^/author/(\w)(\w.*)$            /author/$1/$1$2 [R=301]
    RewriteRule ^/letter/([a-zA-Z])$            /distro/$1/ [R=301]
    RewriteRule ^/lettera/([a-zA-Z])$           /author/$1/ [R=301]
    ErrorLog /var/www/logs/static-error.log     
    CustomLog /var/www/logs/static-access.log common
</VirtualHost>

#
# The following MUST ALWAYS BE LAST in the :80 stack.
# It contains the catchall *.cpantesters.org domain.
#

<VirtualHost 127.0.0.1:80>
    ServerName www.cpantesters.org
    ServerAlias cpantesters.org *.cpantesters.org
    ServerAdmin barbie@missbarbell.co.uk
    DocumentRoot /var/www/cpanreps/html

    # block Microsoft robots
    <Directory /*>
      Order Allow,Deny
      Allow from all
      Deny from 65.55
      Deny from 207.46
    </Directory>

    <Location /robots.txt>
      Allow from all
      #AllowOverride All
    </Location>

    RewriteEngine on
    #RewriteLog "/var/www/logs/rewrite.log"
    #RewriteLogLevel 3

    RewriteRule ^/stats/?$        		http://pass.cpantesters.org [R=301,L]
    RewriteRule ^/stats(/.*)?      		http://pass.cpantesters.org$1 [R=301,L]

    RewriteRule ^/(show|dist|distro|author)/?$  / [R=301]
    RewriteRule ^/show/(\w)(.*)$                /distro/$1/$1$2 [R=301]
    RewriteRule ^/author/(\w)(\w.*)$            /author/$1/$1$2 [R=301]

    RewriteRule ^/?$                                            /cgi-bin/pages.cgi?act=home-main [PT]
    RewriteRule ^/index.html$                                   /cgi-bin/pages.cgi?act=home-main [PT]
    RewriteRule ^/home/(\w+)(.html)?$                           /cgi-bin/pages.cgi?act=home-$1 [PT]
    RewriteRule ^/user/(\w+)(.html)?$                           /cgi-bin/pages.cgi?act=user-$1 [PT]
    RewriteRule ^/page/(\w+)(.html)?$                           /cgi-bin/pages.cgi?act=arts-item&name=$1 [PT]
    RewriteRule ^/cpan/report/([-0-9-Za-z]+)$                   /cgi-bin/view-report.cgi?id=$1&%{QUERY_STRING} [PT]

    RewriteRule ^/author/([A-Za-z])/?$                          /cgi-bin/pages.cgi?act=cpan-authors&name=$1 [PT]
    RewriteRule ^/(?:static/)?author/[A-Za-z]/([-\w.]+)\.rss$   /cgi-bin/pages.cgi?act=cpan-arss&name=$1 [PT]
    RewriteRule ^/(?:static/)?author/[A-Za-z]/([-\w.]+)\.ya?ml$ /cgi-bin/pages.cgi?act=cpan-ayml&name=$1 [PT]
    RewriteRule ^/(author/[A-Za-z]/[-\w.]+\.(json|js))$         /static/$1 [PT]
    RewriteRule ^/author/[A-Za-z]/([-\w.]+)\.html$              /cgi-bin/pages.cgi?act=cpan-author&name=$1 [PT]
    RewriteRule ^/author/[A-Za-z]/([-\w.]+)$                    /cgi-bin/pages.cgi?act=cpan-author&name=$1 [PT]

    RewriteRule ^/distro/([A-Za-z])/?$                          /cgi-bin/pages.cgi?act=cpan-distros&name=$1 [PT]
    RewriteRule ^/(?:static/)?distro/[A-Za-z]/([-\w.]+)\.rss$   /cgi-bin/pages.cgi?act=cpan-drss&name=$1 [PT]
    RewriteRule ^/(?:static/)?distro/[A-Za-z]/([-\w.]+)\.ya?ml$ /cgi-bin/pages.cgi?act=cpan-dyml&name=$1 [PT]
    RewriteRule ^/(distro/[A-Za-z]/[-\w.]+\.(json|js))$         /static/$1 [PT]
    RewriteRule ^/distro/[A-Za-z]/([-\w.]+)\.html$              /cgi-bin/pages.cgi?act=cpan-distro&name=$1 [PT]
    RewriteRule ^/distro/[A-Za-z]/([-\w.]+)$                    /cgi-bin/pages.cgi?act=cpan-distro&name=$1 [PT]

    RewriteRule ^/cgi-bin/pages.cgi$                            /cgi-bin/pages.cgi?%{QUERY_STRING} [PT]
    RewriteRule ^/cgi-bin/reports-summary.cgi$                  /cgi-bin/reports-summary.cgi?%{QUERY_STRING} [PT]
    RewriteRule ^/cgi-bin/reports-metadata.cgi$                 /cgi-bin/reports-metadata.cgi?%{QUERY_STRING} [PT]
    RewriteRule ^/cgi-bin/summary.cgi$                          /cgi-bin/summary.cgi?%{QUERY_STRING} [PT]
    RewriteRule ^/cgi-bin/(.*)$                                 /cgi-bin/pages.cgi?act=error-badcmd [PT]

    ScriptAlias /cgi-bin/pages.cgi      /var/www/reports/cgi-bin/reports.cgi
    ScriptAlias /cgi-bin/               /var/www/reports/cgi-bin/
    #Options +ExecCGI

    ErrorLog /var/www/logs/cpanreps-error.log
    CustomLog /var/www/logs/cpanreps-access.log common
</VirtualHost>