I want a 404 page

Help using razorCMS

Re: I want a 404 page

Postby smiffy6969 » Sun Jun 13, 2010 7:57 pm

Hi,

I think I have manage to find a quick fix,

I noticed during an upgrade run that the 404 wasn't working due to a bug, I have fixed this and now a page that is not found, will default to a 404 header and will also output a 404 standard response message, so this will not break your theme

Now to also benefit you all, I added a new socket

BsocketB('error-page-not-found', array( &$headerError, &$errorOutput ));

basically you can call this socket in a blade pack, to alter the default responses, the variable headerError defaults to this

This is the actual Header

$headerError = "HTTP/1.0 404 Not Found";

and the error output message is this

This is the actual output to screen

$errorOutput = "<p>404 : File Requested was Not Found</p>";

So if you create a simple blade pack, take in these variable and ater them to what you want, you will be able to customise the header and response, if you do not it will output the above as default....

if you want an idea of how to create a blade pack to do this, just ask, or you could have a stab at it yourself......

In addition to this if you want to add in belt and braces, you could also add a redirect in your htaccess, just point it to a page that does not exist if people poke around elsewhere too, and this should provide a catch for it.

These fixes will go live on the next update very very soon, just testing it, it's not really got anything fancy in it, bug and security fixes only really.

smiffy
on a long enough time line, everyones survival rate drops to zero... [ed norton - fight club]
http://www.razorcms.co.uk
http://www.mis-limited.com
smiffy6969
Site Admin
 
Posts: 1372
Joined: Sat May 24, 2008 8:18 am
Location: Loughborough, UK

Re: I want a 404 page

Postby Samy » Tue Jun 15, 2010 9:00 am

Hello Smiffy,

this looks great.
So I will be waiting for the update.

Thanks and greetings, Samy. :-)
Samy
 
Posts: 7
Joined: Tue May 25, 2010 11:10 pm

Re: I want a 404 page

Postby smiffy6969 » Tue Jun 15, 2010 6:46 pm

nearly done, not a milestone release or anything but it will fix this, I have already checked this and it is working. Just trying to get it finalised bud so stay tuned...

smiffy
on a long enough time line, everyones survival rate drops to zero... [ed norton - fight club]
http://www.razorcms.co.uk
http://www.mis-limited.com
smiffy6969
Site Admin
 
Posts: 1372
Joined: Sat May 24, 2008 8:18 am
Location: Loughborough, UK

Re: I want a 404 page

Postby smiffy6969 » Wed Jun 16, 2010 8:42 pm

DONE.......

go check version 1.1, download upgrade, backup site, upgrade site, create page called 404-error-page and put on what you wish, if you like add the error doc setting in htaccess to point to this too, to cover all bases.

This now chucks back a correct 404 header as tested fully, so spiders will get correct response now.

smiffy
on a long enough time line, everyones survival rate drops to zero... [ed norton - fight club]
http://www.razorcms.co.uk
http://www.mis-limited.com
smiffy6969
Site Admin
 
Posts: 1372
Joined: Sat May 24, 2008 8:18 am
Location: Loughborough, UK

Re: I want a 404 page

Postby mistraller » Tue Jun 22, 2010 5:34 pm

Samy wrote:Thanks for your help mistraller.

I just did it like you did - in fact I even copied the text from your 404 page.
Works fine for me now! (Hope it's ok for you)

Of course it's ok, I took the text on some 404 page on the internet also. ;)
Anyway this means editing the .htaccess file by hand.
But the packages also edit this file (for example the SEF URL package).
So this could be a cause for problems ...

My htaccess contained already a lot more than only the razorblade code. That code stays unaltered.

.htaccess is a powerful file, for example, it can also be used for 301 or 302 redirects if you move a page. Using that method, entering a wrong URL will lead you to the new page, instead of a 404 page.
mistraller
 
Posts: 14
Joined: Thu May 27, 2010 5:11 pm

Re: I want a 404 page

Postby mistraller » Wed Jul 28, 2010 9:36 am

I found out that my webserver is actually serving a HTTP 302 instead of 404 code.

That is caused by the full URL in .htaccess

If I add the non SEF-URL in my .htacces, the correct 404 page is not shown.

Not sure how to solve this problem.

Adding a full URL in .htaccess will force apache to use a redirect, (302) and thus it cannot return a 404 anymore.

If you are unsure, use Google Webmaster tool: "Visit as Googlebot". It showed me a 302.
mistraller
 
Posts: 14
Joined: Thu May 27, 2010 5:11 pm

Re: I want a 404 page

Postby Samy » Sun Aug 15, 2010 9:30 pm

Hello smiffy,

sorry I was busy with other stuff for a while ...
... I just came around and saw the update.

I upgraded and everything works beautiful.
Very nice and easy to use solutions.

Thank you so much, Samy. :-)

smiffy6969 wrote:DONE.......

go check version 1.1, download upgrade, backup site, upgrade site, create page called 404-error-page and put on what you wish, if you like add the error doc setting in htaccess to point to this too, to cover all bases.

This now chucks back a correct 404 header as tested fully, so spiders will get correct response now.

smiffy
Samy
 
Posts: 7
Joined: Tue May 25, 2010 11:10 pm

Previous

Return to Usage

Who is online

Users browsing this forum: No registered users and 1 guest

cron