Page 1 of 1

[Solved] Error404 not shown with pretty urls

Posted: Sat Dec 07, 2013 5:20 pm
by thefrozen
Hello guys!

I am currently trying to add a custom error404 page to my CMSMS (1.11.9).
Unfortunately I hit a problem.

I created a page of type error404 but it isn't shown when I enter an url like www.example.com/rubbish
Instead the normal "Start"-page is displayed.

I use internal pretty urls with rewriting in .htaccess.
And I guess that's the problem..

As far as I could find out the following happens:
The server gets the request and handles it using the following rewriting rule:

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
So actually we are now looking for index.php?page=rubbish
CMSMS tries to find such a page but of course can't.
So lib/page.functions.php reaches its end and triggers:

Code: Select all

  // if there's nothing use the default content.
  if( empty($page) )
    {
      // maybe it's the home page.
      $page = $contentops->GetDefaultContent();
    }

  return $page;
Since $page has valid content now no error 404 is thrown. Unfortunately it's not the desired content..

Does anybody have an idea how to deal with this? I can't imagine any rewriting rule handling this case?

Thank you very much!

thefrozen

Edit: This problem was a really nice one - it removed itself.. I have no idea why, but it suddenly just disappeared. I did delete the cache before without success.. Whatever happened, I'm glad it works now.
Also I realized that my analysis of the problem required more coffee - forget everything I wrote up there please. ;)

Thanks for this awesome CMS!