i have found configuration for htaccess to serve files with urlencoded paths with rewrite rules, not running wordpress php files (for wp-super-cache), but it needs custom function as executable file to rewrite, that should be run from rewrite rules, so server admin should make that executable file for wordpress installations, and turn that executable on in apache configuration.
custom function:
#!/usr/bin/php
<?php
set_time_limit(0);
$fdin=fopen("php://stdin","r");
$fdout=fopen("php://stdout","w");
set_file_buffer($fdout,0);
while($i=fgets($fdin)){
$i2=explode('/',rtrim($i));
$i2o=count($i2);
for($j=0;$j<$i2o;$j++){
$i2[$j]=str_replace('%','%25',strtolower(urlencode($i2[$j])));
}
$o=implode('/',$i2)."\n";
fputs($fdout,$o);
}
?>
owned by www-data, runnable(executable), /var/www/localhost/test/localhost/aylandirow3.php .
this file is connected to apache this way:
RewriteMap aylandirow3 prg:/var/www/localhost/test/localhost/aylandirow3.php
this rule cannot be in htaccess. after creating new such file or modifying it, restarting apache is needed, as i know.
custom function probably can be made with c, if made, then indeed no php will be used ) . and i have seen code for perl, how to do this.
i have modified htaccess this way:
replace
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz" [L]
with
RewriteCond %{REQUEST_URI} !^/wp-content/cache/supercache/[^/]+/[^/]+/index\.html\.gz$
RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/${aylandirow3:$1}/index.html.gz" [L]
and replace
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html" [L]
with
RewriteCond %{REQUEST_URI} !^/wp-content/cache/supercache/[^/]+/[^/]+/index\.html\.gz$
RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/${aylandirow3:$1}/index.html" [L]
end of modification.
i have tested this with ab, and it is little slower than old configuration.
old configuration:
Time taken for tests: 0.353 seconds
Requests per second: 141.45 [#/sec] (mean)
Time per request: 35.348 [ms] (mean)
Time per request: 7.070 [ms] (mean, across all concurrent requests)
Transfer rate: 1843.00 [Kbytes/sec] received
Percentage of the requests served within a certain time (ms)
50% 27
...
100% 101 (longest request)
this configuration:
Time taken for tests: 0.377 seconds
Requests per second: 132.59 [#/sec] (mean)
Time per request: 37.710 [ms] (mean)
Time per request: 7.542 [ms] (mean, across all concurrent requests)
Transfer rate: 1727.58 [Kbytes/sec] received
Percentage of the requests served within a certain time (ms)
50% 36
...
100% 75 (longest request)