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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

SOLVED: Problem with 404 Error Page for .php file extensions


5 Posts   4437 Views


4 November 2009 at 4:56am (Last edited: 4 November 2009 5:28am), Community Member, 99 Posts

Hi all,

Wonder if you can help me?

Got an email from client this morning. The 404 Error page is giving some strange results.

There are still some links on google to their old site which do not display the SS 404 Error page as expected, eg:

However, if you were to try something else, such as


that works fine!

But as soon as you add in the .php extension it goes back to what appears to be the server-side error pages.

I am sure there is a good reason for this, but I don't know what it is!

I've logged into the server control panel and tried setting "Custom Error Docs" to both on and off, but that made no difference.

Any help appreciated.




4 November 2009 at 5:12am Community Member, 70 Posts

Hi Linsey

The reason for this is that Silverstripe uses php files itself, so it cannot handle urls ending in .php within it's own cms 404 page system.

What you can do is add a line to the end of your .htaccess file like this:
ErrorDocument 404 /page-not-found

This tells the server to redirect 404's that Silverstripe doesn't handle back to a specific page. The url I have set it to there is the default url for the "Page Not Found" page in SS. You should double check in the cms that your SS 404 page has the same url. If not, change accordingly.



4 November 2009 at 5:23am Community Member, 99 Posts

Hey Ronan,

Thanks for the speedy reply... appreciated.

I kinda thought it was something along those lines, but I was stumped as to what to do about it!

So, just to clairfy... I should put the following line of code:

ErrorDocument 404 /page-not-found

exactly as it appreas above, into the .htaccess file in the site root?




4 November 2009 at 5:23am Community Member, 99 Posts

p.s. yes, that is what the 404 page is called.


4 November 2009 at 5:27am Community Member, 99 Posts

works like a charm, thanks.