[Plugin: WP Super Cache] Incorrect .htaccess rules if you install wordpress in a subdirectory
-
Hello,
today I found a bug in wp-super-cache, that should affect everyone that installs their blogs in a sub directory, instead of directly in the document root.
All the cache files are generated properly, but the rules in .htaccess are wrong.
This is a snippet from the rules that wp-super-cache generated:
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/wordpress/$1/index.html -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/wordpress/$1/index.html [L]
while they, in my case, should be:
RewriteCond %{DOCUMENT_ROOT}/wordpress/wp-content/cache/supercache/%{HTTP_HOST}/wordpress/$1/index.html -f
RewriteRule ^(.*) /wordpress/wp-content/cache/supercache/%{HTTP_HOST}/wordpress/$1/index.html [L]
Note the directory “/wordpress” beneath the document root.
The guilty code is in wsc_mod_rewrite, line 1323:
$inst_root = trailingslashit( str_replace( get_option('siteurl'), '', WP_CONTENT_URL ) );
Instead of just removing the document root from WP_CONTENT_URL, it removes everything up to and including “/wordpress”.
My PHP-Fu isn’t good enough to write a patch, but it’s easy enough for me to tweak .htaccess by hand until this is fixed.
According to the SVN-log, this code last changed in november, and I haven’t noticed it until now. Obviously I don’t get enough traffic. *sniffle* ??
- The topic ‘[Plugin: WP Super Cache] Incorrect .htaccess rules if you install wordpress in a subdirectory’ is closed to new replies.