homepage Welcome to WebmasterWorld Guest from 54.161.191.154
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Content Management
Forum Library, Charter, Moderators: ergophobe

Content Management Forum

    
Joomla Custom 404 page and Server Status Codes
cmendla

10+ Year Member



 
Msg#: 4126901 posted 8:09 pm on May 4, 2010 (gmt 0)

Since I am migrating my sites from frontpage to joomla, the search engines are still showing my old links. The joomla 404 page is pretty blah.

I found a tutorial at [docs.joomla.org...] which shows how to create a joomla custom 404

Four Steps to Creating a Custom 404 Error Page
1. Create an Uncategorized '404' Article

Create an 'uncategorized' article in Joomla! to serve as your 404 Page. Include some text such as Sorry, we could not find the page you were looking for... and if necessary, also any useful navigational links. For example, you may wish to add a link back to your site's home page.


2. Create and copy a link to that new 404 Article.

Create a menu item which links to the new 404 Article and 'apply' your changes. Then copy the URL information (index.php?optio...), set the menu item as 'unpublished' and close out of the menu editing page. You may want to paste the copied URL into Notepad or somewhere accessible for the time-being.


3. Copy error.php to your Template's Directory

In your Joomla! installation copy the file error.php from the templates/system directory, to your Template directory. For example, if I was using a template named 'Cleancloud' I would copy the error.php file to the templates/cleancloud directory.


4. Modify error.php to Redirect 404 Errors to your 404 Article

Edit the error.php file as follows, adding the code below immediately under the 'restricted access' line:


I followed that and it shows a pretty nice 404 page that is a joomla article. HOWEVER, I tested it with an online server status code checker. It was showing as

HTTP Status Code: HTTP/1.1 302 Found


Is the 302 status code OK? I tried to change the php header command to give a 404 and that doesn't seem to work. It throws me back to the windows IE 404 page.

NOTE - the directions say to copy the error.php from the system template to the template you are using. I modified the error.php in the system template folder and that seemed to work OK. That way, if I put a new template up, then the error messages should still work.

Anyway, if the 302 is an acceptable return, then I'm done with this project and I can get on the mower and tackle part of the lawn.


thanks

Chris

 

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4126901 posted 10:12 pm on May 4, 2010 (gmt 0)

A 302-Found response for invalid URLs is unacceptable.

For "missing pages" there are three valid responses: A 410-Gone for intentionally removed resources, a 301-Moved Permanently redirect to a specific replacement page or corrected URL if one exists, or a 404-Not Found if neither of the previous conditions apply.

Returning the correct server status is more important than anything else, especially whether the error page is pretty or not. Search engines don't even look at the error page, they only look at the server status response code.

Returning a 302 status means that any URL requested from your server for which content cannot be provided will result in a 302-Found redirect, followed by a 200-OK if the redirected=to URL is subsequently requested. So the search engine view of this is that an infinite number of URLs exist on your site, and they will arbitrarily limit the depth to which they are willing to crawl your site.

If you watch your logs carefully, you will see occasional requests for "nonsense" URLs coming from Googlebot, Slurp, etc. -- These are not mistakes, nor are they accidental. They are testing your server to see if it returns proper error codes.

You might want to dig around in Joomla-specific forums to see if there is a better solution, or if someone makes a "plug-in" to fix this issue. If there is no solution, please post back here, because I'm sure that many webmasters considering Joomla would abandon the idea if they can't even get 404-Not Found responses right...

[added] To avoid MSIE's "we're smarter than Webmasters" error pages and to ease your testing, consider using Firefox and the "Live HTTP Headers" add-on for Firefox and other Mozilla-based browsers. Alternately, go into MSIE's advanced options and turn off "Show friendly HTTP error pages." [/added]

Jim

cmendla

10+ Year Member



 
Msg#: 4126901 posted 1:54 am on May 5, 2010 (gmt 0)

Jdmorgan

Thanks for the input. I've settled on a little workaround for now.

1. I'll leave the regular joomla error message in place. That returns a 404 for non existant URLs.

2. I opened up the template/system/css/error.css and changed the font size to 14. That makes the error message a bit more readable.

That will solve my immediate problem. I'll keep an eye open for any solutions that will allow me to create a custom 404 that is integrated with joomla. I did see one version where you can include the headers and footers but it probably isn't worth the effort right now.

By simply increasing the font size, the standard joomla error page is a lot more readable. When I get a chance, I can play with the php in the error.php and customize the page a bit more.

thanks again.

ergophobe

WebmasterWorld Administrator ergophobe us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4126901 posted 4:26 pm on May 5, 2010 (gmt 0)

This was common in lots of CMS 3-4 years ago. I thought everyone had fixed it. Are you seeing this with the latest Joomla version?

Ironically, I did a t search for "Joomla Valid 404" and got a link to the extension directory and it returned... a 404. A valid one too. Here's my abbreviated HTTPLiveHeaders output:
http://extensions.joomla.org/extensions/490/details

GET /extensions/490/details HTTP/1.1
Host: extensions.joomla.org
.....
HTTP/1.1 404 Not Found
Date: Wed, 05 May 2010 15:43:24 GMT
Server: Apache
....


So I wonder if there's something wrong with your install.

Also, I believe most Joomla users are running shSEF404 (Is that the one?) in addition to core SEF

[extensions.joomla.org...]
[docs.reviewsforjoomla.com...]

I don't know if it helps with 404s.

See also
[extensions.joomla.org...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Content Management
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved