Jump to:

10848 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Static Publisher .htaccess not working on the live server

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 270 Views
  • joern
    Avatar
    Community Member
    28 Posts

    Static Publisher .htaccess not working on the live server Link to this post

    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]

  • joern
    Avatar
    Community Member
    28 Posts

    Re: Static Publisher .htaccess not working on the live server Link to this post

    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?

    270 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.