Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » .htaccess %{DOCUMENT_ROOT} problem (for static publisher extension)

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

Page: 1
Go to End
Author Topic: 2591 Views
  • Anatol
    Avatar
    126 Posts

    .htaccess %{DOCUMENT_ROOT} problem (for static publisher extension) Link to this post

    Hi,

    just if anyone ever comes across the same problem: here is a question and it comes with the answer. I hope it will save someone a bit of frustration.

    I moved a Silverstripe site with static publisher enabled from my development server to a client's hosted web space. After the shift the static publisher did not work. The cached pages were there but the response header always showed PHP, not HTML - but I was sure the .htaccess file was correct.

    The simple solution was that this host did not know the %{DOCUMENT_ROOT} variable (or they disabled it, I don't know), and so I had to edit .htaccess with a hardcoded path. If that's the case with your hosting company just replace any %{DOCUMENT_ROOT} with

    /absolute/path/from/root/to/cache/%1.html -f

    Not nice, but in my case the only way that worked.

    How to get the path? Just copy and paste the DOCUMENT_ROOT variable from the Environment or PHP Variables section of your phpinfo().

    It's always worth checking the response header if you use the static publisher (I use the Firefox web developer addon for that).

    In this particular case I use the static publisher not because of high traffic but because the host is extreeeeeemly slow in serving PHP pages. I knew there was a catch when the client told me about his super-cheap hosting plan...

    Cheers!
    Anatol

    2591 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.