Creating a custom 403 or not found page

Permalink
I am having trouble getting a custom "page not found" page to show when someone gets a dead page loaded. Does anyone have a solution? I tried the site_theme_paths.php and the theme_paths.php but all I ever got was a blank page with my header but no message stating that this page was not found.
??

jjhanks
 
mario replied on at Permalink Reply
mario
if you can run an htaccess file you can do this to create a custom 403/404/etc.

http://www.freewebmasterhelp.com/tutorials/htaccess/...

You may need to link to it using an absolute path:

http://www.yoursitename.com/custom404page/...

http://www.yoursitename.com/index.php?cID=someNumberThatsYourPage...
jjhanks replied on at Permalink Reply
jjhanks
It seems like there should be a way to do that within the c5 system. If I edit the page not found.php file it would work OK but it seems like it should be simpler than that. Do you know if there is any plan to make it so that any page not found error would simply load the header and footer of whatever theme is being used?
mario replied on at Permalink Reply
mario
you're welcome. :) sorry, not aware of any plan to do so. might be a question for the Concrete 5 team. You could join the Beta Team and/or submit it as a change to be included in the next core update... or change the core yourself and submit it to the community. ;)
mdg replied on at Permalink Reply
This is an appalling oversight.

You're right it should be a simple matter of assigning it via the admin section.

It's what most good cms packages do.

Having to edit templates and code blocks is insane.
focus43 replied on at Permalink Reply
focus43
An "appalling" oversight?
And editing a template is "insane"?

You have to be joking mdg, you drama queen. Its not very difficult to change, maybe the only oversight is that the core team hasn't yet documented how to do it.
jordanlev replied on at Permalink Reply
jordanlev
I wrote up how to do this here:
http://c5cookbook.com/recipes/customize_404_page...

If it's not working, it might be that your theme doesn't have a view.php file, or that you didn't create the new single_pages/page_not_found.php file.

Also, if you go to your site's dashboard and click "Sitemap", you should see "Page Not Found" in the list, and you should be able to edit it (although this doesn't allow you to change the actual text of the "page not found" message).

Hope that helps.

-Jordan
mroberte replied on at Permalink Reply
So I'm trying to figure out my 404 page woes. Basically what is happening is that if you put anything after the main url, it shows a 404 page from my hosting company and not the custom one that I made within C5. ie-http://www.certain.com/asdf

However when you have any page that has index.php/asdf is when the 404 shows.

What is going on with this? I changed all files from your cookbook but its still not looking for the right file. I'm running the latest 5.6.0.2 version.
jordanlev replied on at Permalink Reply
jordanlev
Perhaps you don't have pretty url's enabled in your site? (That's usually the problem when things work with "index.php" in the url but not without it).
queesamor replied on at Permalink Reply
queesamor
Hi jordanlev, I know this is a long-old thread, but it seems be be the best I can find by searching around. You state that from the sitemap the "Page Not Found" page should be editable, but that is not the case for me. I certainly can click on "Design" or "Properties" for the page, but when I click "Visit", I don't get the edit button, and thus am not able to make any changes. Also, in the Design popup I can change the theme, but it has no effect whatsoever on the not found page.

It seems as though the only way for a simple site editor to change their not found / forbidden pages is to hire someone who knows how to and is comfortable editing code, is that correct? If so, why? Why can the basic choice of site-wide theme not be applied to these pages? As it is, the pages are next-to-useless, since all modern browsers do just fine displaying their own 404 pages, and the supplied "theme" applied to c5's 40x pages look nothing at all like the rest of the site...

Help?
jordanlev replied on at Permalink Reply
jordanlev
When you say "you don't get the edit button", do you mean that no Edit button appears in your admin toolbar at the top of the page? Or that there are no editable areas on the page to click on (e.g. "Add To Main", "Add To Sidebar", etc.)?

If there's simply no "Edit" button at the top toolbar, that would be because you're not logged in or the user you are logged in as doesn't have permissions. If you're logged in as the admin user, then that's really weird and if the button isn't showing up it is probably due to some php or javascript error on the page.

If you can enter "Edit Mode" on the page, but don't see any editable areas to click on, then that is because you don't have any editable areas declared in your theme's view.php file.

As for your other questions (about how difficult it is to change things without hiring someone, and why the 404 page is set up the way it is)... I unfortunately don't know the answer because I didn't build this system (I just use it a lot). All I can offer is a sympathetic ear because I have definitely been in your situation many times, and it is very frustrating indeed.

-Jordan
queesamor replied on at Permalink Reply
queesamor
I am logged in as admin and no Edit button appears in the admin toolbar. In fact, when I use the sitemap to navigate to the Page Not Found or Page Forbidden system pages, no admin bar appears at the top at all. Both those pages have styling that is *similar to* the admin bar at the top, but it is a different width, and there are no buttons (edit, dashboard, etc).

My view.php for the active template on my site is simply
<?php
    print $innerContent;
?>

so I don't think there is any php or javascript error on that page. All that being said, I cannot enter "Edit" mode on these pages. From the context-menu on the Sitemap I can click "Design", etc, but as I noted earlier, those changes seem to have no effect.
jordanlev replied on at Permalink Reply
jordanlev
I experienced this problem the other day, and it was due to a javascript error on the page. Unfortunately it could be due to anything, so I am not able to tell you how to fix it.

Try looking at any errors that appear in the "console" of your browser's web developer tools.
queesamor replied on at Permalink Reply
queesamor
I have a vanilla install of 5.6.1.2 w/ no sample content and no
customization except to turn on pretty urls, and the 404 and 403 pages have
no edit/dashboard bar. There are no errors in the console. These pages are
obviously not intended for site administrators to be able to change
anything, including the theme.


-Denver Root
jordanlev replied on at Permalink Reply
jordanlev
Bummer. Sorry, I don't have any more ideas :(
avch replied on at Permalink Reply
Hello Jordan,
I am hoping you can help me. Any expired pages on my site do not show the "Page not found" that my developer modified. Do you know why this would be? Instead, the guest sees the main login page when they try to view an expired page. I have set the permissions so that Guest can view the "Page not found". Any information would be helpful.
Thanks.
jordanlev replied on at Permalink Reply
jordanlev
No idea -- sorry.
gumptech replied on at Permalink Reply
What is your advice on this set up? I am making my 1st website and after some testing put together this quick and easy setup using cpanel and concrete5.
Cpanel has custom error pages, I create a generic custom 404.shtml. In the 404.shtml I place
<meta http-equiv="Refresh" 
 content="0; URL=http://www.mydomain.com/404">

in between the head section.
Then in C5 I create a page called "404" matching my layout/theme.
In the page properties under header select Meta Title and type 404 Page Not Found
Then under Navigation and Indexing select Exclude From Search Index

Now all my 404 pages are redirected to a custom 404 page.
My new custom 404 page view html source=
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>404 Page Not Found</title>
<meta name="description" content="404" />
    <meta name="robots" content="noindex" />
<meta name="generator" content="concrete5 - 5.6.1.2" />


Here is my generic 404.shtml with redirect
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>404 File Not Found</title>
<meta name="robots" content="noindex,noarchive" />
<meta http-equiv="Content-type" content="text/html;charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Refresh" 
 content="0; URL=http://www.mydomain.com">
</head>
<body>
<h1>404 File Not Found</h1>
<p>The page you requested could not be found on this site. It is possible that the document was relocated or that the address was entered incorrectly.</p>
<ul>
<li>
jordanlev replied on at Permalink Reply
jordanlev
I don't have an opinion one way or the other on it, but if it's working for you I say "go for it!"