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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   1224 Views

Avatar
joern

Community Member, 28 Posts

12 April 2013 at 4:07am

hi,
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]

Avatar
joern

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?