Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 02-11-2009 22:12:32

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

404 Header When Item Is Invalid?

If an old product link is hit and the product is no longer in the database, this message is displayed   invaliditem telling the customer the item is invalid, make a selection from the menu.

#1 is I would alter the displayed message to read "This item is sold out or no longer available. Please make another selection from our site menu."

#2 is I would like that page to return a 404 header "not found". That way products you remove from your site are no longered spidered and indexed in the search engines. Currently, that page returns a 200 "ok" header. So 100 deleted products all point to the same page with a 200 header and nothing is telling the search engines that item is gone.

How can I apply a 404 header when     invaliditem     is called?


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#2 02-14-2009 09:05:04

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: 404 Header When Item Is Invalid?

Noone has a clue how to accomplish this?


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#3 02-14-2009 12:57:11

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: 404 Header When Item Is Invalid?

theblade24 wrote:

#1 is I would alter the displayed message to read "This item is sold out or no longer available. Please make another selection from our site menu."

You'll have to manually update the ccp0.invaliditem ID in the khxc_messages table to alter the message about an item being invalid.  The message displayed by default is "The item you selected cannot be viewed.  Please make a selection from the menu to continue.".

theblade24 wrote:

#2 is I would like that page to return a 404 header "not found".  How can I apply a 404 header when     invaliditem     is called?

You'd have to do that with entries in .htaccess.

Offline

 

#4 02-14-2009 14:33:29

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: 404 Header When Item Is Invalid?

The 404 would have to be generated by CCP as it would have already passed through htaccess and made it to the point that the item is not in the db and in turn displays invaliditem.

Currently a link residing in the search engine (but is no longer in the site db) goes to the invalid item page and returns a header of 200 ok. So if you delete 100 products, those 100 products will continue to be spidered and indexed by all the search engines because they will get a 200 ok header when they visit each url.....  and duplicate content penalty will be applied because eventually youll have 100 pages all with the same exact content "The item you selected cannot be viewed.  Please make a selection from the menu to continue."

If an item is no longer offered, that url should return a 404 header. ATS modded CCP5.1 to do this for me inside of CCP.

How can this be done inside of CCP6?

Last edited by theblade24 (02-14-2009 14:34:32)


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#5 02-14-2009 16:08:13

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: 404 Header When Item Is Invalid?

It can't be done in CCP.  You should know which products have been removed and if you add their URLs to .htaccess they'll get caught before they get to CCP.

Offline

 

#6 02-14-2009 17:58:33

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: 404 Header When Item Is Invalid?

You can't add hundreds, thousands, of lines to htaccess. The server would crawl.

CCP isn't marketed for small stores with onesie twosie changing products. If you add or drop a vendor you could have ten, a hundred, a thousand products no longer available. So all those products continue to return a 200 ok header to search engines even though they no longer exist.

That is flawed logic.

If it could be done in CCP5.1 it can be done in CCP6.


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#7 02-14-2009 18:27:13

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: 404 Header When Item Is Invalid?

theblade24 wrote:

You can't add hundreds, thousands, of lines to htaccess. The server would crawl.

Not true at all.  Apache is extremely good at what it does and a large .htaccess file should cause no perceptible difference in response time.

theblade24 wrote:

If it could be done in CCP5.1 it can be done in CCP6.

Comparing the 2 versions is like comparing a VM Beetle to a Lamborghini.

Offline

 

#8 02-15-2009 07:16:48

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: 404 Header When Item Is Invalid?

In the area where the error message logic is...

What if an if statement was entered there so if "error message = invaliditem" then die

and it would blow me out of ccp with an error just like the page didnt exist on the server?

I could then build a custom 404 error page to redirect after 5 seconds to the home page.

Can that be done? If invaliditem is called it blows you out?  Not 500 internal server error, it just errors you out of ccp entirely?


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#9 02-16-2009 13:22:43

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: 404 Header When Item Is Invalid?

Dave, can you point me please to the location in the CCP6 code where http headers are output?


CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#10 02-16-2009 14:03:40

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: 404 Header When Item Is Invalid?

In the core file names KHXC_Display but you need to be VERY careful if you're going to try to change it.  I do not recommend attempting it (I know I sure wouldn't).

Offline

 

#11 02-16-2009 14:30:14

theblade24
Member
From: Tampa, Florida
Registered: 11-19-2003
Posts: 384
Website

Re: 404 Header When Item Is Invalid?

If a product, category, or page is not found in the db at all......

is there an app or namespace or something called besides the invaliditem message? something that could work in an if statement?

or could the if statement include whatever triggers the invaliditem message be used?

I'm assuming you're talking about this area

Code:

          } else {

               $expdate    = @gmdate('D, d M Y H:i:s', @time() - 3600);
               $nowdate    = @gmdate('D, d M Y H:i:s', @time());
               $contlength = strlen($this->buffered_output);

               header('Pragma: no-cache');
               header('Cache-Control: must-revalidate');
               header('Expires: '           . $expdate . ' GMT');
               header('Content-Length: '    . $contlength);
               header('Last-Modified: '     . $nowdate . ' GMT');
               header('X-Powered-By: KHXC/' . $this->version);

          } // End of if statement.

CCP 5.1
CCP 5.1
CCP 5.1

Offline

 

#12 02-16-2009 14:41:47

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: 404 Header When Item Is Invalid?

theblade24 wrote:

is there an app or namespace or something called besides the invaliditem message? something that could work in an if statement?

Not really.  CCP buffers all of its output and calls the skin as the very last thing before the output buffer is sent to the browser.

theblade24 wrote:

or could the if statement include whatever triggers the invaliditem message be used?

I suppose you could brute force things and find all of the places where that message is used and blow away the buffered output and do something completely different outside of CCP.  You'd have to modify several pieces of core code to accomplish that though.

theblade24 wrote:

I'm assuming you're talking about this area

Code:

          } else {

               $expdate    = @gmdate('D, d M Y H:i:s', @time() - 3600);
               $nowdate    = @gmdate('D, d M Y H:i:s', @time());
               $contlength = strlen($this->buffered_output);

               header('Pragma: no-cache');
               header('Cache-Control: must-revalidate');
               header('Expires: '           . $expdate . ' GMT');
               header('Content-Length: '    . $contlength);
               header('Last-Modified: '     . $nowdate . ' GMT');
               header('X-Powered-By: KHXC/' . $this->version);

          } // End of if statement.

That's where the headers are started yes.

Offline

 

Board footer