# When we get URIs with %20s or other escaped characters in them, # a simple RedirectMatch won't do because in the query string # DESCRIBE query, the escaped characters will be unescaped at # some point during processing. So this is bad: # # RedirectMatch 303 (/rdf/.*) http://rdfabout.com/sparql?query=DESCRIBE+%3Chttp://www.rdfabout.com$1%3E # # Instead, we need to double-escape the characters: The percent # signs should ultimately be escaped so the processor gets back # the original escaping when unescaping is applied. # # To do this, we need to use mod_rewrite. However, mod_rewrite is # operating on the unescaped URI, so we need the 'escape' mapping # function, which needs to be activated in httpd.conf with: # RewriteMap esc int:escape # The rewrite rule below re-escapes the unescaped URI (getting back # the problematic URL we started with), and then mod_rewrite # escapes it again when it sends the redirect, finally achieving # the double-escape. RewriteEngine on RewriteBase "/" RewriteRule ^(rdf/.*) http://%{HTTP_HOST}/sparql?query=DESCRIBE+ [R=303]