0

My website is displaying a blank page when incorrect/absent URLs are used. But I would like it to show a 404 page such as this template I've created.

I have tried to set my global template preferences, as recommended here, but each time I hit save it reverts back to "none" for the 404 template preference.

I have attempted to use codes such as: {if no_results} {redirect="404"} {/if}

and

{if no_results OR segment_2!=""} {redirect="404"} {/if}

and have even changed "404" to a full URL ... All to no avail.

Oh, and I also created a global variable, {404} using {if no_results} {redirect="404"} {/if} as the content. (Grasping at all straws here!)

My EE and other coding knowledge is very basic, but I can generally understand basic instructions. I've tried searching online for the answer and am coming up blank.

Any advice?

2 Answers 2

0

These settings might be coded up in config.php which would override attempts to change the global template preferences set in the CP. You shouldn't need that global variable, sounds like trouble to me.

5
  • Thank you for your reply. I'm very unfamiliar with php stuff, but here's the code related to 404s that I found within the config.php file. Based on what I said above, can you offer any advice on what/how to edit this? Thank you so very much for any assistance. /* Templates Preferences -------------------------------------------------------------------*/ $config['save_tmpl_files'] = "y"; $config['tmpl_file_basepath'] = $config['server_path']."assets/thm/site_themes"; $config['site_404'] = "404/index"; $config['strict_urls'] = "y"; Mar 23, 2015 at 10:45
  • I am not a php coder myself, you won't really need to know php to edit these. All options are documented here ellislab.com/expressionengine/user-guide/general/… site_404 is pointing to 404/index but you want it to point to home/404 - that change may be all you need. You can also remove that line entirely if you'd rather manage it in the control panel. Mar 23, 2015 at 15:04
  • Thank you. Removing the line from the config.php fixed it all ... making the control panel work like a charm. Now to jazz up my 404 page a bit. :) Mar 23, 2015 at 20:38
  • So I've been walking you through this and Jon comes along and says I'm right and you give him the correct answer? Mar 24, 2015 at 19:17
  • I am sorry; I am still learning how the forum works and thought the check mark was simply "question answered; no further assistance required". I didn't know it was specific to an individual post/comment. I certainly didn't mean to cause any offence and I am extremely grateful for the help you gave. Mar 25, 2015 at 19:49
0

Christy is correct saying that your config.php settings are overriding the control panel settings.

Based on the settings you listed, you should be able to remove or comment out the line

$config['site_404'] = "404/index"; 

Then continue following the EllisLab guide to set the correct 404 template from within the control panel.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.