Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

d7a7z7e7d

Archived
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Real Name
    Doug

d7a7z7e7d's Achievements

  1. Are you creating a separate file called "404.php" and putting it in your catalog/includes directory? Ok, here is a STEP BY STEP TO FIX THE GOOGLE SITEMAP 404 ERROR PROBLEM: 1) Open: catalog/index.php Near the very top of the file, find around line 13: require('includes/application_top.php'); Put the following code immediate AFTER the above code: //START OF 404 if (isset($HTTP_GET_VARS['products_id']) || (isset($cPath) && tep_not_null($cPath))) { // Attempting to access product or category. Do not redirect to 404. } else { $filename = $_SERVER['REQUEST_URI']; if ($filename == "/") $filename = basename($_SERVER['PHP_SELF']); if (!file_exists($filename)) { // Attempting to access a file that we could not find. require('includes/404.php'); exit; } } //END OF 404 2) Create a new file: catalog/includes/404.php Put the following code inside of this file: <?php header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); ?> Code your custom 404 Error page output here... <p>For example: <hr> <h1>404 Not Found</h1> The file you requested could not be found. 3) Upload both files to the appropriate directory and try going to a URL that you know doesn't exist (i.e.: www.yourserver.com/asdofijsafoij). If you do this correctly, you should now have a 404 error page that you can customize. When you go to the HTTP Viewer and type in www.yourserver.com/index.php you will get an HTTP Status of 200 OK, but when you type in www.yourserver.com/aosdijoiasdoijf you will get an HTTP Status of 404 NOT FOUND. Hope this helps, Doug
  2. I am using Google XML Sitemap w/ Admin http://www.oscommerce.com/community/contributions,3439 No. I'm not using any template system. My "fix" should work so long as you put the index code near the top of the file (i.e. right after requiring application_top.php).
  3. I seemed to figure out a temporary fix for this if anyone else needs it. // INDEX.PHP if (!isset($HTTP_GET_VARS['products_id']) && (!isset($cPath) && !tep_not_null($cPath))){ $filename = $_SERVER['REQUEST_URI']; if ($filename == "/") $filename = basename($_SERVER['PHP_SELF']); if (!file_exists($filename)) { require('includes/404.php'); exit; } } // INCLUDES/404.PHP <? header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); echo "File Not Found"; ?>
  4. I just started using Google Sitemap and one of the problems I have ran into is that Google requires a 404 error page. Using the SEO contrib, the .htaccess file won't allow for this as any URL that doesn't exist in the filesystem gets rewritten as index.php. Is there a possible fix for this so that I can still have SEO URLs and keep a 404 error page for pages that don't exist? The only possible solution I can think of is to have index.php check to see if the user is trying to go to a category/product and if so, redirect them to that product. Otherwise, if they seem to be accessing a file, check for its existence and then somehow redirect them to a 404 if it's not valid. Is there even a php function that will do a real 404 redirect that WONT return a status of 200? Any help would be greatly appreciated! Thank you!
×
×
  • Create New...