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-26-2013 14:33:55

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

How to Make CCP8 return a 404 error code for pages not found

Please can you confirm if the cart should return a "404 page not found error" if the url does not exist and you arrive at the page that states "The page requested could not be located. Please make a selection from the menu to continue."

I tried this with a non-existent url "http://www.quasarelectronics.co.uk/thispagedoesnotexist" and then tried the same url in google webmaster using Fetch as Google. Google returns a success result as offers to add it to the indexed pages.

I would have thought this should return a 404 page error otherwise Google will index all these page not found error and create a lot of duplicate content problems.


Simon

Offline

 

#2 02-27-2013 08:59:56

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

I've got this on the list todo.  The code I have right now for this is editing the file {private}/apps/cms/CMS_Content/CMS_Content.php.  In the display() function, replace:

Code:

$this->CORE_Display->include_file('cms','pagenotfound.php');

With:

Code:

 $this->globals('core_display.suppress_skin',1);

header('HTTP/1.1 404 Not Found');
header('Location: ' . $this->CORE_Display->link_namespace('cms','display',array('ref'=>'splash')));

return 1;

Nick Hendler

Offline

 

#3 02-27-2013 09:20:57

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

I tried the fix and then got google to fetch another fictitious page (http://www.quasarelectronics.co.uk/morenonsense) but it still thinks its a good url.

I also checked using http://www.searchenginepromotionhelp.co … hecker.php and this reports the code being returned is a 302.

Last edited by sdn (02-27-2013 15:41:55)


Simon

Offline

 

#4 02-28-2013 09:35:14

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

For whatever reason your server is pushing the 404 error code over to a 302.  I just checked as well.  What happens when you comment out or remove this line:

Code:

header('Location: ' . $this->CORE_Display->link_namespace('cms','display',array('ref'=>'splash')));

??


Nick Hendler

Offline

 

#5 02-28-2013 09:43:15

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

That works perfectly. Both Google and the other site now return a 404 error.

That will make Google much happier.

BTW I fixed our htaccess file (I think). It needed to have \ added to the redirects like this:

RewriteRule ^admin\/c\-us\.htm$ "http\:\/\/www\.quasarelectronics\.co\.uk\/Contact" [R=301,L]

Strangely google and godaddy SEO are still reporting some server errors although we upgraded to a considerably more expensive VPS package.

Thanks Nick

Last edited by sdn (02-28-2013 09:48:50)


Simon

Offline

 

#6 02-28-2013 09:52:17

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

No problem.  Typically in .htaccess only a period (.) needs to be escaped in the first section of the rewrite rule.  Therefore this is valid:

RewriteRule ^admin/c-us\.htm$ http://www.quasarelectronics.co.uk/Contact [L,R=301]


Nick Hendler

Offline

 

#7 02-28-2013 10:01:43

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

OK I will give that format a try. It will make our bloated htaccess file a bit smaller. I used cPanel to create an example rewrite and this is how it formatted it so I just followed that example to create the rest.

You might remember than the error caused was it adding ?COREseourl=/oldfilename.htm after all the page redirect urls. Of course Google helpfully indexed all of them giving loads of duplicate content problems so the 404 fix will flush those out of the system.

Last edited by sdn (02-28-2013 10:34:04)


Simon

Offline

 

#8 02-28-2013 14:11:14

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: How to Make CCP8 return a 404 error code for pages not found

One solution is to place a noindex tag in the header of the CCP nonexistant page. That will stop SE's from indexing the page yet show your customer something nice.

Offline

 

#9 03-04-2013 02:41:42

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

I spoke too soon on this. If the page does not exist you get a blank screen now. See http://www.quasarelectronics.co.uk/avsl … io-out.htm for details.

There are other cases that cause a 500 server error page to be returned e.g. http://www.quasarelectronics.com/mailman/create

Please can you advise soonest. I have also PMd you about the problems we have experienced.

Last edited by sdn (03-04-2013 02:45:13)


Simon

Offline

 

#10 03-04-2013 08:55:39

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

You may simply need to set up a 404 error page in your .htaccess file in order to avoid a blank screen for 404s.  Or, uncomment the redirect line and instead redirect to a 404.html.

As far as the /mailman links not working, in your .htaccess you'll need to add this above the CCP8 rules:

Code:

RewriteRule ^mailman/(.*) mailman/$1 [L,PT]

Nick Hendler

Offline

 

#11 03-08-2013 01:28:22

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

This is still not working correctly.

If you add some gibberish after an Item/ or Category/ url CCP returns slighty different  "index,follow" pages as below.

How to change these pages to "noindex,follow"?

Page Text: The item you selected cannot be viewed. Please make a selection from the menu to continue.
<title>Item Details</title>
<meta name="robots" content="index,follow" />

Page Text: There are no items to display which match your request. Please use the menu to continue.
<title>Category</title>
<meta name="robots" content="index,follow" />


Simon

Offline

 

#12 03-08-2013 13:23:52

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

What does your code look like now?  Did you take my advise and set up a 404 page?


Nick Hendler

Offline

 

#13 03-08-2013 16:46:51

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

We already had a "404.shtml" page but the line "ErrorDocument 404 /404.shtml" had dropped out of our htaccess file so added near the top under "Options All -Indexes".

The foot now looks like this:

RewriteRule ^index.php - [L,PT]
RewriteRule ^$ index.php?COREseourl=/ [L,PT]
RewriteRule ^/$ index.php?COREseourl=/ [L,PT]
RewriteRule ^sitemap\.xml utilities/sitemap.xml [L,PT]
RewriteRule ^rss\.xml utilities/rss.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?COREseourl=/$1 [L,PT]
RewriteRule ^mailman/(.*) mailman/$1 [L,PT]
RewriteCond %{QUERY_STRING} ^COREseourl$
RewriteRule ^(.*)$ /$1 [L,R=301]

I am afraid to say it still returns a 200 success code for a non-existent file in the CCP8 environment (like http://www.quasarelectronics.co.uk/Item … t-nonsense) but......

I have reincluded the CMS_content line you suggested I comment out "header('Location: ' . $this->CORE_Display->link_namespace('cms','display',array('ref'=>'404.shtml')));" and our custom 404 page is now displayed for a url like http://www.quasarelectronics.co.uk/nonsense.htm. So thats one problem fixed.

I also tried going back to the original "$this->CORE_Display->include_file('cms','pagenotfound.php');" version but this still returns a 200.

CMS_content.php is now:

$this->globals('core_display.suppress_skin',1);
header('HTTP/1.1 404 Not Found');
header('Location: ' . $this->CORE_Display->link_namespace('cms','display',array('ref'=>'404.shtml')));
return 1;

Can I raise a ticket and get your engineers to resolve this as it has been going on for weeks now and I really need it resolved.

Last edited by sdn (03-09-2013 02:51:17)


Simon

Offline

 

#14 03-11-2013 09:19:29

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

Change:

Code:

header('Location: ' . $this->CORE_Display->link_namespace('cms','display',array('ref'=>'404.shtml')));

To:

Code:

header('Location: http://www.quasarelectronics.co.uk/404.shtml');

Nick Hendler

Offline

 

#15 03-11-2013 11:37:41

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

I have done that and still the same page and 200 success code is returned. Code now reads:

$this->globals('core_display.suppress_skin',1);
header('HTTP/1.1 404 Not Found');
// header('Location: ' . $this->CORE_Display->link_namespace('cms','display',array('ref'=>'http://www.quasarelectronics.co.uk/404.shtml')));
header('Location: http://www.quasarelectronics.co.uk/404.shtml');
return 1;


Simon

Offline

 

#16 03-12-2013 09:40:47

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

Check with your host on this.  You're issuing a 404 and printing the location of your 404 page.  There's no reason it isn't working as far as I can tell.


Nick Hendler

Offline

 

#17 03-26-2013 17:20:25

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

The host has replied as follows:

"When we access the non-existent page normally, the server access logs show the below.

31.170.127.251 - - [25/Mar/2013:06:32:22 +0000] "GET /bvmhgmgm HTTP/1.1" 302 20 "-" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0"
31.170.127.251 - - [25/Mar/2013:06:32:23 +0000] "GET /404.shtml HTTP/1.1" 200 1175 "- " "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0"

Here, you can see the first error code is returned as 302, but it shows the correct 404 page. Also after accessing the non-existent page through code checker, the same behavior was noticed. See the below logs.

69.56.174.178 - - [25/Mar/2013:06:30:47 +0000] "GET /afbsadhfhsdh HTTP/1.1" 302 - "http://www.searchenginepromotionhelp.com/" "Promotion_Tools_http_www.searchenginepromotionhelp.com"
69.56.174.178 - - [25/Mar/2013:06:30:47 +0000] "GET /404.shtml HTTP/1.1" 200 2821 "http://www.searchenginepromotionhelp.com/" "Promotion_Tools_http_www.searchenginepromotionhelp.com"

We would suggest you to ask your web developer regarding this and let us know if there is anything that needs changed on the server. We will do that for you."


Simon

Offline

 

#18 03-27-2013 07:36:10

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

I think the server is misconfigured.  It should respond with a 404 and not a 302 on not found pages.  According to your host's remarks, it never returns a 404 and always a 302.


Nick Hendler

Offline

 

#19 03-29-2013 03:34:56

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

I am going to trial a different hosting company in an attempt to solve this problem. Is there a preferred OS for CCP8 to run on? As our CCP8 software licence is registered to our current domain,  will there be a problem if we try to pre-install it on the trial server prior to making the DNS changeover?

Last edited by sdn (04-01-2013 09:04:00)


Simon

Offline

 

#20 04-01-2013 08:55:27

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

(1) I always prefer Linux as opposed to Windows for speed/security reasons.

(2) Contact the custom shop with your current license key and a request for a matching dev key.  When you get the dev key, make sure you enter that key in for the license key in the private config.php file on the test install.


Nick Hendler

Offline

 

#21 04-04-2013 06:31:21

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

I was thinking about the actual OS. The choices are:

CentOS 6 64-bit
CentOS 5 64-bit
Fedora 14 64-bit
Debian Squeeze 64-bit
Ubuntu 12.04 64-bit
Ubuntu 10.10 64-bit
Ubuntu 10.04 64-bit


Simon

Offline

 

#22 04-04-2013 07:39:46

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

All of those are good choices.  We run RedHat on our servers, so I'd be partial to Fedora, but that's just me.  I've had experience with Debian and Ubuntu as well and both are top notch.


Nick Hendler

Offline

 

#23 04-23-2013 10:49:23

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

I have still not resolved this 404 issue. Although the 404 page page appears it is reported as a 302 redirect with just the recommended lines you recommend for the htaccess file with CCP8.

If I rem out the line "RewriteRule ^(.*) index.php?COREseourl=/$1 [L,PT]" the server returns the correct 404 response.

Our server is running "CENTOS 6.4 x86_64 vmware server1 WHM 11.36.0 (build 14)". This seems like a fairly standard setup to me.

I really need this problem sorted out as it is having a very detrimental effect on our search engine rankings.


Simon

Offline

 

#24 04-24-2013 07:42:49

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: How to Make CCP8 return a 404 error code for pages not found

The line you're commenting out is the main SEO URL rule.  Without it SEO URLs will not work in the software.  Can you please post the URL where you're experiencing the 302 issue?


Nick Hendler

Offline

 

#25 04-24-2013 09:34:51

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to Make CCP8 return a 404 error code for pages not found

Yes I realise that is the SEO rewrites line.

It will generate a 302 on any non-existent page outside the cart environemnt like http://www.quasarelectronics.co.uk/nosuchfile.htm

As well as Google telling me about soft 404s I use http://www.searchenginepromotionhelp.co … -response/ for testing.


Simon

Offline

 

Board footer