httpd/conf/httpd.conf
author Yves Lafon <ylafon@w3.org>
Thu, 26 Mar 2015 22:10:34 +0100
changeset 3303 35b522f708d2
parent 3256 81a24724d6e0
permissions -rw-r--r--
protocol relative link for icons
     1 #                                                                -*- apache -*-
     2 # Example httpd.conf snippet for W3C Markup Validation Service
     3 # Note that this is not a complete server configuration file, but contains
     4 # only the validator-specific part.
     5 #
     6 # You can use the Include directive for including this in your main httpd.conf.
     7 #
     8 # The values below assume that you have the validator files in
     9 # /usr/local/validator.  If not, tune them according to your setup.
    10 #
    11 # To run the validator without mod_perl 2.x even if it is loaded, comment
    12 # out the "IfDefine MODPERL2" sections below.
    13 
    14 # Referer dependent redirects.
    15 
    16 <IfModule mod_rewrite.c>
    17 RewriteEngine On
    18 
    19 # check/referer is deprecated in favor of check?uri=referer
    20 RewriteRule ^(/+w3c-validator/+check)/+referr?er$ $1?uri=referer [R=301,QSA,L]
    21 
    22 # If Referer is present, redirect check?uri=referer to check?uri=$Referer
    23 RewriteRule . - [E=have_uri_referer:false]
    24 RewriteCond %{QUERY_STRING} (^|.*?[;&])ur[il]=referer([;&].*|$)
    25 RewriteRule . - [E=qs1:%1,E=qs2:%2,E=have_uri_referer:true]
    26 RewriteCond %{ENV:have_uri_referer} =true
    27 RewriteCond %{HTTP_REFERER} ^(.+)$
    28 RewriteRule ^/+w3c-validator/+check$ \
    29             /w3c-validator/check?%{ENV:qs1}uri=%1%{ENV:qs2} [R,B,NE,L]
    30 </IfModule>
    31 
    32 # Tell httpd that check and sendfeedback.pl are CGI scripts.
    33 
    34 Alias /w3c-validator/check /usr/local/validator/cgi-bin/check
    35 AliasMatch ^/+w3c-validator/+feedback(\.html)?$ \
    36            /usr/local/validator/cgi-bin/sendfeedback.pl
    37 
    38 <IfDefine MODPERL2>
    39 # Note: this block affects the whole server, not just the validator.
    40 PerlSwitches -T
    41 PerlPostConfigRequire /usr/local/validator/httpd/mod_perl/startup.pl
    42 </IfDefine>
    43 
    44 <LocationMatch "^/+w3c-validator/+(check|feedback(\.html)?)$">
    45   Options               +ExecCGI
    46   SetHandler            cgi-script
    47 <IfDefine MODPERL2>
    48   SetHandler            perl-script
    49   PerlResponseHandler   ModPerl::Registry
    50   PerlOptions           +ParseHeaders
    51 </IfDefine>
    52   # Environment settings affecting validator's outside connectivity, see
    53   # LWP::UserAgent and Net::FTP documentation for details.
    54   #SetEnv                http_proxy      http://proxy:3128
    55   #SetEnv                https_proxy     http://proxy:3128
    56   #SetEnv                ftp_proxy       http://proxy:3128
    57   #SetEnv                no_proxy        localdomain
    58   #SetEnv                FTP_PASSIVE     1
    59 </LocationMatch>
    60 
    61 # This is the directory where you have the validator's *.html, *.css etc files.
    62 
    63 Alias /w3c-validator/   /usr/local/validator/htdocs/
    64 <Directory /usr/local/validator/htdocs/>
    65   Options               IncludesNOEXEC Indexes MultiViews
    66   AllowOverride         None
    67   AddHandler            server-parsed .html
    68   AddCharset            utf-8         .html
    69   AddEncoding           x-gzip        .gz
    70   <Files *.js.gz>
    71     ForceType           application/javascript
    72   </Files>
    73   <Files *.css.gz>
    74     ForceType           text/css
    75   </Files>
    76 
    77   <IfModule mod_rewrite.c>
    78   Options +SymLinksIfOwnerMatch
    79   RewriteBase /w3c-validator/
    80   RewriteRule fragment-upload(\.html)? detailed.html#validate-by-input [R,L,NE]
    81   RewriteRule file-upload(\.html)? detailed.html#validate-by-upload [R,L,NE]
    82   </IfModule>
    83 
    84   <IfModule mod_expires.c>
    85   ExpiresActive On
    86   ExpiresByType image/gif A2592000
    87   ExpiresByType image/png A2592000
    88   ExpiresByType text/html A604800
    89   ExpiresByType text/css A2592000
    90   ExpiresByType text/javascript A2592000
    91   ExpiresByType application/javascript A2592000
    92   ExpiresByType application/ecmascript A2592000
    93   </IfModule>
    94 </Directory>
    95 
    96 # Atom news feed
    97 Redirect /w3c-validator/whatsnew.atom \
    98          http://www.w3.org/QA/Tools/validator-whatsnew.atom