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.

Template Questions

dev mode caching? issue for 404 Page (Page Type Error Page)


5 Posts   1340 Views


13 May 2009 at 4:10am Community Member, 3 Posts

Hello folks,

I recently deployed a Silverstripe website. Everything is fine so far, but the <% base_tag %> - Control isn't working properly for my 404 page. It always prints out the url of my develop-system!? If I use the command echo Director::absoluteBaseURL() directly (within the Controller class), I get the right information. I also get the right information, when I run the site in dev mode, it's working perfect and printing the right url. Of course I don't want to run the page in dev mode ...

So my question is, why is there a different output of the <% base_tag %> - Control depending on dev mode? What can I do to get the right output for 404 when dev mode is deactived?

Any hints?



13 May 2009 at 10:04pm Community Member, 787 Posts

So you are saying on a live server , the Base_Tag spits out your development system URL ? Weird ? AFAIK , this URL is completely dynamic.

What does your .htaccess look like ?


13 May 2009 at 10:31pm Community Member, 3 Posts

yep, really weird, and only for page type Error Page!

Despite of some php5 initialization .htaccess is standard:

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

<Files *.ss>
Order deny,allow
Deny from all
Allow from

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !html*
RewriteCond %{REQUEST_URI} !_ts_temp*

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]


15 May 2009 at 12:14pm Forum Moderator, 5511 Posts

The 404 page is generated in the Assets Section (so it can display without hitting the DB if necessary). If you have moved the site from dev -> live this file was probably copied and not remade. To regenerate it delete the 404.html file from assets/ if you have one. Hopefully this is the only issue!


16 May 2009 at 1:05am Community Member, 3 Posts

Thanks for the hint. Deleting didn't work, but knowing where to look, we simply changed the basepath there :).