mark nottingham

Emulating W3C ,tools with mod_rewrite

Sunday, 23 October 2005

I don’t know if this has already been done (it’s not exactly rocket science), but for the benefit of those who want to emulate the W3C’s cool ,tools functions with mod_rewrite;

# tools
RewriteRule ^(.*),validate http://validator.w3.org/check?uri=http://%{HTTP_HOST}/$1 [L,R]
RewriteRule ^(.*),checklink http://validator.w3.org/checklink?uri=http://%{HTTP_HOST}/$1 [L,R]
RewriteRule ^(.*),rchecklink http://validator.w3.org/checklink?recursive=on&uri=http://%{HTTP_HOST}/$1 [L,R]
RewriteRule ^(.*),text http://cgi.w3.org/cgi-bin/html2txt?url=http://%{HTTP_HOST}/$1 [L,R]
RewriteRule ^(.*),cssvalidate http://jigsaw.w3.org/css-validator/validator?usermedium=all&uri=http://%{HTTP_HOST}/$1 [L,R]
RewriteRule ^(.*),links http://www.google.com/search?as_lq=http://%{HTTP_HOST}/$1 [L,R]
RewriteRule ^(.*),blinks http://blogsearch.google.com/blogsearch?scoring=d&q=link:http://%{HTTP_HOST}/$1 [L,R]
RewriteRule ^(.*),cacheability http://www.ircache.net/cgi-bin/cacheability.py?descend=on&query=http://%{HTTP_HOST}/$1 [L,R]

For example, you can validate this page.


3 Comments

ingo said:

%{HOST} should do the trick.

Sunday, October 23 2005 at 2:59 AM

ingo said:

arg. make that %{HTTP_HOST}.

Sunday, October 23 2005 at 3:00 AM