Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Static Publisher .htaccess not working on the live server

Go to End

2 Posts   852 Views


Community Member, 28 Posts

12 April 2013 at 4:07am

i'm trying to push the performance of my SS 3.1.beta instance a bit further and implemented the FileSystemPublisher.
On my local MAMP system everything works fine, but it seems that the "check and redirect to cache" rules aren't catching the requests.

I'm not very familiar with htaccess-stuff but is it possible that my hoster disabled some of the required variables. My regular mod_rewrite rules are working like a charm.

any ideas?

  # Cached content - live webserver 
  RewriteCond %{REQUEST_METHOD} ^GET$ 
  RewriteCond %{QUERY_STRING} ^$ 
  RewriteCond %{REQUEST_URI} /(.*[^/])/?$ 
  RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f 
  RewriteCond %{REQUEST_FILENAME} !-f 
  RewriteRule .* /cache/%1.html [L]


Community Member, 28 Posts

13 April 2013 at 12:32am

Edited: 13/04/2013 12:32am

I did a couple of tests and found a strange behavior with the DOCUMENT_ROOT variable.
On my local environment %{DOCUMENT_ROOT} and _SERVER["DOCUMENT_ROOT"] are pointing to the same directory but they differ on the live server and therefore the check that checks the existence of the cache file will always fail.

%{DOCUMENT_ROOT} = /opt/RZapache/htdocs
_SERVER["DOCUMENT_ROOT"]	/home/…/http/…/htdocs

Any Ideas how I can use the RewriteConditions without the DOCUMENT_ROOT variable?