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.

Template Questions /

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

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


Go to End


5 Posts   2295 Views

Avatar
Nils73

Community Member, 3 Posts

13 May 2009 at 4:10am

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?

Nils

Avatar
Fuzz10

Community Member, 791 Posts

13 May 2009 at 10:04pm

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 ?

Avatar
Nils73

Community Member, 3 Posts

13 May 2009 at 10:31pm

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

### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>

<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]
</IfModule>
### SILVERSTRIPE END ###

Avatar
Willr

Forum Moderator, 5523 Posts

15 May 2009 at 12:14pm

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!

Avatar
Nils73

Community Member, 3 Posts

16 May 2009 at 1:05am

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