Halfagain IM Forums
May 23, 2012, 12:16 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Due to increasing spam we are forced to make this forum "Read Only". If you have an issue, most likely was discussed here. Use the Search function and try to find related discussions. If you can't find any helpful information, just email support at halfagain dot com"
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: 404 Handling needs improvement  (Read 1336 times)
0 Members and 1 Guest are viewing this topic.
pga123
Newbie
*

Karma: 10
Offline Offline

Posts: 22


« on: September 06, 2008, 18:24 »

I am building a database driven site which includes my own content plus StoreStacker.

To implement it I need to intercept 404 errors, look at the url, and return a dynamically generated page from mySQL, much like what SS does. The problem is that SS already does this. When I configure Apache to call a custom 404 handler it doesn't, because SS is in the middle.

Can you explain what SS is doing so I can fix this?

Also, I have raised this before with no response and it is a MAJOR BUG:  because SS depends on 404 errors, there is no 'Page not found' error page. If a user puts in a wrong url they get a blank white page. This includes ALL OF THE PAGES INDEXED BY GOOGLE THAT ARE STILL IN ITS INDEX BUT NO LONGER IN YOUR SS DATABASE!!!!!!

Basically, 90% of the people who find your site on Google will get a blank white page when they click on the result in the SERP.

So SS development team, please, can we get a hook into the 404 handler?Huh?

Please?Huh?
Logged
Omar
Here to help.
Administrator
Hero Member
*****

Karma: 10001
Offline Offline

Posts: 2687


« Reply #1 on: September 06, 2008, 18:59 »

Well, when you install SS, it will be SS that handle 404 error. I don't know what your own script should do, but when SS is installed there is no real 404 header even for 404 error pages.  When a page is called, if there is no mysql info for that page, an error (404) message is printed. That message is controlled in utilities.tpl template.

As about your major bug, i don't know where you raised that problem, i can't find any post about such a bug. I will need some more details and examples, because there is no such bug that i know of. If some product is deleted from database, or a category, or a stattic page, if nothing broken in script or templates, there will be a 404 messge page, not a blank page.
« Last Edit: September 06, 2008, 22:43 by Omar » Logged
pga123
Newbie
*

Karma: 10
Offline Offline

Posts: 22


« Reply #2 on: September 06, 2008, 21:39 »

Thanks, Omar. There are two issues here.
First Issue:
Quote from: Omar
If some product is deleted from database, or a category, or a stattic page, if nothing broken in script or templates, there will be a 404 message page, not a blank page.

You are right. This happens with my template, not with the standard ones. I did not have a utilities.tpl file. I have fixed this now. Thanks for your help.

My apologies for the rant. The MAJOR BUG was in my template!

Second Issue:
Below is a revised .htaccess file with two changes:
1) |^/articles/ has been added to this list of exceptions, so that a request for any document in that directory will not get sent to index.php
2) A custom error handler has been set up in the cgi-bin.

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^[^\.]*[^/]$
RewriteRule (.+) $1/ [R,L]
RewriteCond %{REQUEST_URI} !^/index\.php|^/admin|^/click\.php|^/templates/|^/install\.php|^/robots\.txt$|^/favicon\.ico|^/sitemap\.xml|^/articles/
RewriteRule (.+) index.php?req=$1&%{QUERY_STRING}
ErrorDocument 404 /cgi-bin/404.cgi

The result is satisfactory. My custom error handler gets called for all requests in /articles/ so I can implement a dynamic content site in that directory. The standard StoreStacker error handler gets called everywhere  else.

Again, thanks for the utilities.tpl tip.

Cheers,

Peter
Logged
Omar
Here to help.
Administrator
Hero Member
*****

Karma: 10001
Offline Offline

Posts: 2687


« Reply #3 on: September 06, 2008, 22:47 »

You're welcome. I am glad it works now and is no bug afterall Smiley. Your htaccess changes are correct and logic, i couldn't know that though, since i didn't knew what you added/changed in your files/folders/templates.. Is not something anyone should have since is tuned for your own needs may but thanks for posted it, some1 may find it helpful some day
Logged
taylor21
Newbie
*

Karma: 10
Offline Offline

Posts: 9


WWW
« Reply #4 on: September 07, 2008, 18:06 »

Thank you to both of you for posting this, I used this to find the place to change the message to suggest the person select a new catagory.

I'm changing over a lot of BANS stores, so I will be having a few people hit 404s, is there a way to just put them at the home page?

If someone has a minute to write that code change up for me I would really appreciate it Smiley
Logged
Omar
Here to help.
Administrator
Hero Member
*****

Karma: 10001
Offline Offline

Posts: 2687


« Reply #5 on: September 08, 2008, 08:59 »

Open the utilities.tpl of the template that you are using and look for the code below:


{if isset($error)}
  {if $error==404}
 

    404 - Not found
 

  {/if}


Just put anything you want instead of the simple "404 - Not found" text. You can use simple text or html code, make that page look lot beter, even add some ads/banners if you want to.
Logged
taylor21
Newbie
*

Karma: 10
Offline Offline

Posts: 9


WWW
« Reply #6 on: September 08, 2008, 12:28 »

Great Thanks, I'll give them a big "Click Here Now" button Smiley
Logged
flashdiva
Jr. Member
**

Karma: 11
Offline Offline

Posts: 119


WWW
« Reply #7 on: September 26, 2008, 22:30 »

Quote from: Omar
Open the utilities.tpl of the template that you are using and look for the code below:


{if isset($error)}
  {if $error==404}
 

    404 - Not found
 

  {/if}


Just put anything you want instead of the simple "404 - Not found" text. You can use simple text or html code, make that page look lot beter, even add some ads/banners if you want to.


I've built some very good 404 pages with the utilities.tpl and based on that, saving the code to HTML, I built a 404 page for the main domain. My SS is in a folder called "store."

And I added similar coding to my .htaccess file, as shown above. In the main public_html folder... so this controls the primary domain.

What this has done....

When on the primary site, if someone gets a non-existent page, it sends them to the 404 page controlled by the .htaccess file.

When inside the store, they are sent to the utilities.tpl page. Since I used that via saving the actual generated HTML page, the both of them LOOK and act exactly the same.

I've added special offers and loads of goodies to both pages. Cheesy

And both pages look exactly like the rest of the site, with menus/navigation exactly the same. For the HTML version, you will have to tweak some of the links/URLs.
Logged

Leanne Carson Boyd
Waybill To Adventure LLC. Ebook Gallery. Gallery of Works.
Extraordinary Flash. And more...[1] [2] [3]...Credentials. :eek:
"You do not really understand something unless you can
explain it to your grandmother" - Albert Einstein
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!