statcache icon indicating copy to clipboard operation
statcache copied to clipboard

Trouble with Apache setup

Open studiorepublic opened this issue 9 years ago • 2 comments

Uncached pages work fine, but anything which has been cached throws a 404. Here's my config

RewriteCond %{DOCUMENT_ROOT}/versant-homes/statcache%{REQUEST_URI}/~index.html -f
RewriteRule ^(.*)$ versant-homes/statcache/$1~index.html [L,QSA]

RewriteCond %{DOCUMENT_ROOT}/versant-homes/statcache%{REQUEST_URI} -f
RewriteRule ^(.*)$ versant-homes/statcache/$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ versant-homes/index.php?q=$1 [L,QSA,NC]

Any ideas would be great!

studiorepublic avatar May 27 '15 16:05 studiorepublic

I don't have any apache setups available atm—I prefer nginx—but could it be that the rules are capturing the opening slash resulting in two slashes when used in the replacement? IOW, should the rules look like this instead:

RewriteRule ^/(.*)$ versant-homes/statcache/$1 [L,QSA]

^ notice the opening slash not within the capture for $1

opengeek avatar May 27 '15 17:05 opengeek

Actually, a different suggestion was just to add an initial slash to the rule target, e.g.

RewriteRule ^(.*)$ /versant-homes/statcache/$1~index.html [L,QSA]

opengeek avatar May 27 '15 17:05 opengeek