Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Page Not Found override not working for me

Page Not Found override not working for me

Locked

Views: 14,007

Results 21 to 40 of 43
This thread is locked. New replies are disabled.
9 Aug 2008, 2:09 AM
#21
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Page Not Found override not working for me

sillygrl1212:

DrByte:

What happens if you go to: index.php?main_page=page_not_found directly?

I'm pretty sure your issue is a Windoze issue

It just says on the bottom of the browser :"Connecting" and nothing happens.

I'm inclined to believe you have a server problem with the redirect.

9 Aug 2008, 3:21 AM
#22
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

DrByte:

I'm inclined to believe you have a server problem with the redirect.

Then why if I set the server default for 404 pages to index.php or any other page they display correctly? Wouldn't this indicate that the server redirect works fine?

9 Aug 2008, 3:31 AM
#23
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

Yes, the server's redirect when the 404 is encountered is working fine.
I was referring to the PHP redirect conducted by the server when the page_not_found page is called.

I apologize - I'm really only guessing at this point, because of the thousands of sites I've seen using the same code, yours is the only one I've heard of doing what you're saying it's doing.

Plus, I'm still convinced that microsoft has no business writing webserver software ... they always seem to botch something up -- at least they're good at something.

Now, thinking about it some more, if it's the index.php?main_page=page_not_found that's hanging, then maybe you've got a bad upload of some of your files. Try installing the debug logging utility mentioned in step 2a of this FAQ, and see what it reports when the page hangs: https://www.zen-cart.com/tutorials/index.php?article=82

9 Aug 2008, 4:04 AM
#24
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

DrByte:

Yes, the server's redirect when the 404 is encountered is working fine.
I was referring to the PHP redirect conducted by the server when the page_not_found page is called.

I apologize - I'm really only guessing at this point, because of the thousands of sites I've seen using the same code, yours is the only one I've heard of doing what you're saying it's doing.

Plus, I'm still convinced that microsoft has no business writing webserver software ... they always seem to botch something up -- at least they're good at something.

Now, thinking about it some more, if it's the index.php?main_page=page_not_found that's hanging, then maybe you've got a bad upload of some of your files. Try installing the debug logging utility mentioned in step 2a of this FAQ, and see what it reports when the page hangs: https://www.zen-cart.com/tutorials/index.php?article=82

Thanks for your help. I will download it and work with it tomorrow and report back what the result was. Have a great weekend.

9 Aug 2008, 7:49 PM
#25
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

DrByte:

Now, thinking about it some more, if it's the index.php?main_page=page_not_found that's hanging, then maybe you've got a bad upload of some of your files. Try installing the debug logging utility mentioned in step 2a of this FAQ, and see what it reports when the page hangs: https://www.zen-cart.com/tutorials/index.php?article=82

The error log showed:

[09-Aug-2008 12:04:07] PHP Fatal error: Maximum execution time of 30 seconds exceeded in \includes\templates\template_default\common\tpl_columnar_display.php on line 37

Here is the copy of my tpl_columnar_display.php (I marked the line 37 in red)
================```

<?php /** * Common Template - tpl_columnar_display.php * * This file is used for generating tabular output where needed, based on the supplied array of table-cell contents. * * @package templateSystem * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license [url]http://www.zen-cart.com/license/2_0.txt[/url] GNU Public License V2.0 * @version $Id: tpl_columnar_display.php 3157 2006-03-10 23:24:22Z drbyte $ */ ?> <?php if ($title) { ?> <?php echo $title; ?> <?php } ?> <?php if (is_array($list_box_contents) > 0 ) { for($row=0;$row<sizeof($list_box_contents);$row++) { $params = ""; //if (isset($list_box_contents[$row]['params'])) $params .= ' ' . $list_box_contents[$row]['params']; ?> <?php for($col=0;$col<sizeof($list_box_contents[$row]);$col++) { $r_params = ""; if (isset($list_box_contents[$row][$col]['params'])) $r_params .= ' ' . (string)$list_box_contents[$row][$col]['params']; if (isset($list_box_contents[$row][$col]['text'])) { ?>
<?php echo '<div' . $r_params . '>' . $list_box_contents[$row][$col]['text'] .  '</div>' . "\n"; ?>
<?php } } ?> <br class="clearBoth" /> <?php } } ?> ```
9 Aug 2008, 8:05 PM
#26
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

I'm puzzled that there'd be a timeout in that location of the code on just that page, unless you had installed some sort of customization to the page-not-found code and/or site map code.

How did you install Zen Cart?

Did you upload the files yourself? What program did you use to do the upload?

Is it possible that any of the files were missed during the upload?
Or that any were corrupted or incompletely transferred?

One way to find out is to download all the files to your PC into another folder, and then compare what you downloaded with what you thought you uploaded. WinMerge is a handy free tool to very quickly compare directories of files and point out differences.

A related article that talks about the comparison process can be found here: http://www.zen-cart.com/wiki/index.php/Troubleshoot_-_Diagnosing_Obscure_Issues

9 Aug 2008, 11:41 PM
#27
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

ZenCart was installed via utility provided by the web hosting company. Seems pretty reliable source because I have been working on the store for a while and never run into a corrupted or incomplete version of any file. Page_not_found or sitemap files have not been touched - the ones I'm using for testing are still original files (not in override directories). I'm using the iC Acadame template v. 1.2

I'm familiar with WinMerge and will compare files next week. Could you possibly suggest a short list of files involved with the page_not_found process I could compare first?...

9 Aug 2008, 11:45 PM
#28
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

sillygrl1212:

I'm using the iC Acadame template v. 1.2

Does it make any difference if you change your template to "Classic" for a few minutes and test?

10 Aug 2008, 1:40 AM
#29
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

DrByte:

Does it make any difference if you change your template to "Classic" for a few minutes and test?

I did "Classic" - the same result...

I was thinking - since except the page_not_found.php all other *.php or *.htm pages display when so set on server would it be possible to make an adjustment to the code:
header("HTTP/1.1 301 Moved Permanently");
header("Location: index.php?main_page=page_not_found");

so robots see 301 Moved Permanently and it displays any other (newly created custom page with 404 text within the ZenCart structure window, just like EZPages do)?

I don't care about displaying sitemap.

10 Aug 2008, 2:30 AM
#30
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

You could change the Location: path to whatever you like.

It would be better to identify and fix whatever's causing your page_not_found page to not display correctly. Something else might be related to it, which might interfere with customer shopping experience.

10 Aug 2008, 4:22 AM
#31
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

OK. I'm going to compare my files to the original as you suggested. Could you please suggest a list of files involved with the page_not_found.php so I could avoid comparing everything since as far as I know this is the only glitch I have.
Thanks.

10 Aug 2008, 4:43 AM
#32
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

Parts and pieces from many different places inside the /includes folder are involved. I'd recommend a full compare of /includes/.
Files named "checkout_" or "account_" can be ignored during this particular compare.

11 Aug 2008, 1:58 AM
#33
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

DrByte:

Parts and pieces from many different places inside the /includes folder are involved. I'd recommend a full compare of /includes/.
Files named "checkout_" or "account_" can be ignored during this particular compare.

I compared the files. The discrepancy I came accross was in /includes/templates/template_default/common/tpl_main_page.php in the following 50 line section (the versionID of this file 6564 2007-07-05 used "$this_is_home_page", my file uses "$this_is_main_page").

* @license [url]http://www.zen-cart.com/license/2_0.txt[/url] GNU Public License V2.0
 * @version $Id: tpl_main_page.php 4886 2006-11-05 09:01:18Z drbyte $
 */

// the following IF statement can be duplicated/modified as needed to set additional flags
  if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
    $flag_disable_right = true;
  }


  $header_template = 'tpl_header.php';
  $footer_template = 'tpl_footer.php';
  $left_column_file = 'column_left.php';
  $right_column_file = 'column_right.php';
  $body_id = ($this_is_main_page) ? 'indexHome' : str_replace('_', '', $_GET['main_page']);
?>

I didn't know what I should exactly do with this finding but just to try something I edited the page_not_found.php in root directory and changed Location: line to
/index.php?home_page=page_not_found

The server is still pointed to page_not_found.php for 404 error. Now when trying to access a non - valid page instead of long delay and blank browser's window the browser displays my index page (sending robots the correct 301 header). The same happens when trying to access the
/index.php?main_page=page_not_found.php or just the
/page_not_found.php

I don't know but it seems I'm getting a little bit closer but still the page not found.php is not displaying my custom page_not_found define page...

I also extensively tested all functions of the store (you said it is better to fix this problem since it might effect other areas) but it seems to function flawlessly.

If I only could get ANY custom page displayed on 404 error (instead of currently displaying main page) which could communicate to robots the 301 AND displaying within the Zen Cart (and not as a separate window) I would be very very happy...

11 Aug 2008, 5:32 AM
#34
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

sillygrl1212:

I compared the files. The discrepancy I came accross was in /includes/templates/template_default/common/tpl_main_page.php in the following 50 line section (the versionID of this file 6564 2007-07-05 used "$this_is_home_page", my file uses "$this_is_main_page").That was a bug in v1.3.5 or v1.3.6 I think, which must be what your icAcademe template is using, instead of the fix.

sillygrl1212:

I didn't know what I should exactly do with this finding but just to try something I edited the page_not_found.php in root directory and changed Location: line to
/index.php?home_page=page_not_foundNo, don't change that.

sillygrl1212:

I also extensively tested all functions of the store (you said it is better to fix this problem since it might effect other areas) but it seems to function flawlessly.Good to know.
sillygrl1212:

If I only could get ANY custom page displayed on 404 error (instead of currently displaying main page) which could communicate to robots the 301 AND displaying within the Zen Cart (and not as a separate window) I would be very very happy...
Okay, you can go ahead and change the URL on the Location: parameter in your /page_not_found.php file to something else you prefer.

11 Aug 2008, 8:27 PM
#35
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

DrByte;595582]That was a bug in v1.3.5 or v1.3.6 I think, which must be what your icAcademe template is using, instead of the fix.

Should I correct this line then to use "this_is_home_page" instead of "this_is_main_page" ?

I edited the page_not_found.php in root directory and changed Location: line to
/index.php?home_page=page_not_found
No, don't change that.
OK, I will change it back then... just would like to know why shouldn't it be changed.

If I only could get ANY custom page displayed on 404 error (instead of currently displaying main page) which could communicate to robots the 301 AND displaying within the Zen Cart (and not as a separate window) I would be very very happy... Okay, you can go ahead and change the URL on the Location: parameter in your /page_not_found.php file to something else you prefer.

The only problem is that the any page I call via Location line opens in a new window. I want it to open within the ZenCart main window, center column

12 Aug 2008, 4:58 AM
#36
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

The correct variable is $this_is_home_page

If you change the URL and say "home_page=" instead of "main_page=" then Zen Cart won't have a clue what you're talking about because Zen Cart never looks for "home_page=" on the URL. If you look at every link Zen Cart generates you'll see "main_page=" on it. Why change the pattern?

12 Aug 2008, 5:05 AM
#37
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

sillygrl1212:

The only problem is that the any page I call via Location line opens in a new window. I want it to open within the ZenCart main window, center column
I don't know what you're meaning by "opens in a new window". There's nothing in the PHP redirect Location call that tells it to open in a new window.

I've been trying to let you figure out workarounds on your own, yet it appears I must spell it out for you. Try changing this:```
/*

  • redirect to the page_not_found page after sending spiders the "moved" message
    /
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: index.php?main_page=page_not_found");
    ?>
    to this:
    /
  • redirect to the page_not_found page after sending spiders the "moved" message
    */
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: [B]index.php[/B]");
    ?>
Surely your home page will work?
If that change makes no difference, then I'm sorry, you really need to get someone to look at your server's configuration and fix whatever's busted with it.
12 Aug 2008, 5:06 AM
#38
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

Another question: why are people hitting page-not-found on your site anyway? Do you have a whole bunch of bad links to your site out there somewhere?
Why are you spending so much time on this topic? Maybe there's an even greater problem that should be solved in a more efficient way than setting up a page-not-found catch-all?

12 Aug 2008, 8:52 PM
#39
sillygrl1212 avatar

sillygrl1212

New Zenner

Join Date:
Aug 2008
Posts:
20
Plugin Contributions:
0

Re: Page Not Found override not working for me

DrByte;595939]I don't know what you're meaning by "opens in a new window". There's nothing in the PHP redirect Location call that tells it to open in a new window.

Any page I tried in Location call
i.e.

/*
* redirect to the page_not_found page after sending spiders the "moved" message
*/
header("HTTP/1.1 301 Moved Permanently");
header("Location: CUSTOM.htm");
?>

resulted in opening a new (separate) browser window. Of course I did test with index.php there as you are suggesting here and it did work but the whole point for me was to display there my custom.htm 404 page...

I've been trying to let you figure out workarounds on your own, yet it appears I must spell it out for you.

This hurts... but you got me motivated to find a creative solution and to solve my problem so THANKS! I created a new EZ Page with desired custom 404 text and my new page_not_found.php file looks now like this:

header("HTTP/1.1 301 Moved Permanently");
header("Location: index.php?main_page=page&id=16&chapter=0");

Now it does everything I needed: sends 301 to robots, communicates to customer what I want it to communicate and looks nice within the car structure (not opening newbrowser's window).

Another question: why are people hitting page-not-found on your site anyway? Do you have a whole bunch of bad links to your site out there somewhere?
Why are you spending so much time on this topic? Maybe there's an even greater problem that should be solved in a more efficient way than setting up a page-not-found catch-all?

Before it was a ZenCart store -it was operating on standard html based code for quite some time. Since all files were replaced w/ Zen files our old invalid links are still out there. They are slowly being removed by serach engines but some of them keep coming back. The page_not_found redirect, I feel, will help to get rid of the old listing much faster. So in short this is an old problem and not a new problem.

Finally, I went ahead and replaced $this_is_main_page string in my ICAcademe's /common/tpl_main_page.php file with $this_is_home_page string as you suggested. It doesn't seem to make any difference to functionality but it is consistent with the rest of the site's codes.

12 Aug 2008, 9:47 PM
#40
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Page Not Found override not working for me

sillygrl1212:

Before it was a ZenCart store -it was operating on standard html based code for quite some time. Since all files were replaced w/ Zen files our old invalid links are still out there. They are slowly being removed by serach engines but some of them keep coming back. The page_not_found redirect, I feel, will help to get rid of the old listing much faster. So in short this is an old problem and not a new problem.Certainly a valid reason for getting a fix to the problem.

Apologies for coming off sounding "short" with you. I didn't mean to be rude, just to-the-point.

Glad you got it sorted out with a solution that works for you!