Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (85 sloc) 3.78 KB
# -*- apache -*-
# Example httpd.conf snippet for W3C Markup Validation Service
# Note that this is not a complete server configuration file, but contains
# only the validator-specific part.
#
# You can use the Include directive for including this in your main httpd.conf.
#
# The values below assume that you have the validator files in
# /usr/local/validator. If not, tune them according to your setup.
#
# To run the validator without mod_perl 2.x even if it is loaded, comment
# out the "IfDefine MODPERL2" sections below.
# Referer dependent redirects.
<IfModule mod_rewrite.c>
RewriteEngine On
# check/referer is deprecated in favor of check?uri=referer
RewriteRule ^(/+w3c-validator/+check)/+referr?er$ $1?uri=referer [R=301,QSA,L]
# If Referer is present, redirect check?uri=referer to check?uri=$Referer
RewriteRule . - [E=have_uri_referer:false]
RewriteCond %{QUERY_STRING} (^|.*?[;&])ur[il]=referer([;&].*|$)
RewriteRule . - [E=qs1:%1,E=qs2:%2,E=have_uri_referer:true]
RewriteCond %{ENV:have_uri_referer} =true
RewriteCond %{HTTP_REFERER} ^(.+)$
RewriteRule ^/+w3c-validator/+check$ \
/w3c-validator/check?%{ENV:qs1}uri=%1%{ENV:qs2} [R,B,NE,L]
</IfModule>
# Tell httpd that check and sendfeedback.pl are CGI scripts.
Alias /w3c-validator/check /usr/local/validator/cgi-bin/check
AliasMatch ^/+w3c-validator/+feedback(\.html)?$ \
/usr/local/validator/cgi-bin/sendfeedback.pl
<IfDefine MODPERL2>
# Note: this block affects the whole server, not just the validator.
PerlSwitches -T
PerlPostConfigRequire /usr/local/validator/httpd/mod_perl/startup.pl
</IfDefine>
<LocationMatch "^/+w3c-validator/+(check|feedback(\.html)?)$">
Options +ExecCGI
SetHandler cgi-script
<IfDefine MODPERL2>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
</IfDefine>
# Environment settings affecting validator's outside connectivity, see
# LWP::UserAgent and Net::FTP documentation for details.
#SetEnv http_proxy http://proxy:3128
#SetEnv https_proxy http://proxy:3128
#SetEnv ftp_proxy http://proxy:3128
#SetEnv no_proxy localdomain
#SetEnv FTP_PASSIVE 1
</LocationMatch>
# This is the directory where you have the validator's *.html, *.css etc files.
Alias /w3c-validator/ /usr/local/validator/htdocs/
<Directory /usr/local/validator/htdocs/>
Options IncludesNOEXEC Indexes MultiViews
AllowOverride None
AddHandler server-parsed .html
AddCharset utf-8 .html
AddEncoding x-gzip .gz
<Files *.js.gz>
ForceType application/javascript
</Files>
<Files *.css.gz>
ForceType text/css
</Files>
<IfModule mod_rewrite.c>
Options +SymLinksIfOwnerMatch
RewriteBase /w3c-validator/
RewriteRule fragment-upload(\.html)? detailed.html#validate-by-input [R,L,NE]
RewriteRule file-upload(\.html)? detailed.html#validate-by-upload [R,L,NE]
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/html "access plus 1 week"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/ecmascript "access plus 1 month"
</IfModule>
</Directory>
# Atom news feed
Redirect /w3c-validator/whatsnew.atom \
http://www.w3.org/QA/Tools/validator-whatsnew.atom