Page 1 of 1

htaccess non existing pages

Posted: Sun Aug 21, 2005 7:13 pm
by gamespel
I have a problem on my site http://www.spellenblog.nl

When you go to the site everything is o.k., but when you write a wrong url like http://www.spellenblog.nl/werwer it displaying the index.php page.

Is there a way to change it that it goes to /errordoc/404.html ?

Re: htaccess non existing pages

Posted: Sun Aug 21, 2005 7:23 pm
by garvinhicking
You can do that by editing your Serendipity Configuration and setting URL Rewriting to "none".

You will loose the "pretty" URLs when doing this, though. If you really need a 404 page, you can edit your index.php file and look for

Code: Select all

} else {
    header('HTTP/1.0 404 Not found');
    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
    // printf('<div class="serendipity_msg_important">' . DOCUMENT_NOT_FOUND .
}
Change that include_once to include the 404 file you want to show. Or replace it with "exit;" instead, then your users only get a 404 error.

Regards,
Garvin

Posted: Sun Aug 21, 2005 9:07 pm
by gamespel
When I replace the original page ( include/genpage.inc.php ) into errordoc/404.html I get a fatal error

Fatal error: Call to a member function on a non-object in /xxx/xxx/xxx/www.spellenblog.nl/htdocs/index.php on line 314

Posted: Mon Aug 22, 2005 12:17 am
by MySchizoBuddy
i actually like this rewrite .:)
however i t does not completely render the page. the logo doesnt display.
if u go to http://myschizobuddy.com/uploads/ it goes back to index.php, but the logo is missing from the site :?

Posted: Mon Aug 22, 2005 2:06 pm
by garvinhicking
MySchizoBuddy - the logo is missing because:

Code: Select all

<img src="templates/leaf/img/logo.png" alt="Logo" />
you are using a relative directory reference here. It should rather look like this:

Code: Select all

<img src="/templates/leaf/img/logo.png" alt="Logo" />
Gamespel: Please show me how you modified it exactly. I'm afraid you made a typing mistake there, hence the error.

Regards,
Garvin

Posted: Tue Aug 23, 2005 1:34 am
by gamespel
If changed:
include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');

into:
include_once(S9Y_INCLUDE_PATH . 'errordoc/404.html');

I have also tried:
include_once(S9Y_INCLUDE_PATH . '/errordoc/404.html');

Posted: Tue Aug 23, 2005 1:13 pm
by garvinhicking
Okay, please try to add an "exit;" after the include line:

Code: Select all

include_once(S9Y_INCLUDE_PATH . 'errordoc/404.html');
exit;
That should do the trick?

Regards,
Garvin

Posted: Wed Aug 24, 2005 4:37 am
by gamespel
Yes this works....

Thanks Garvin