Any chance this page can somehow return a status code 404 instead of 200?
Announcement
Collapse
No announcement yet.
Page NTFD - return a 404 status code instead of 200?
Collapse
X
-
Re: Page NTFD - return a 404 status code instead of 200?
Unfortunately all Miva Merchant pages return 200.
--
Thank you,
Gary Hodder
Support
--
CybrHost Corp. - http://www.cybrhost.com/ - [email protected]
+1-866-300-MIVA - Professional Miva & E-Commerce web hosting services.Premiere Hosting Partner Since 1999
-
Re: Page NTFD - return a 404 status code instead of 200?
See the end of this thread
http://extranet.mivamerchant.com/for...404#post102768Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
Facebook http://www.facebook.com/EmporiumPlus
Twitter http://twitter.com/emporiumplus
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
FYI, I just pasted a redirect to my custom 404 page in the head tag of NTFD. Don't know if that's the end you're trying to achieve, or if there's some adverse affect I don't know about yet. Maybe it's a bad idea? Wouldn't mind some feedback on this concept.
Thanks,
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
For some reason I missed Bill's response and just saw it now, Bill that worked perfectly
Mark, what you did will work but it won't accomplish my original goal of sending a status code 404 to the web browser. It displays the error page correctly, but the status code sent to the browser is 200, which means the page was found. It's better to send a 404 so if the person requesting the page is actually a search engine, the engine will be made aware that the page is gone. If you send the engine a 200, it thinks the page is valid, and it will index your error page and show that in the search results.
It's usually not a major problem but there's just no reason to send an incorrect code if it can be avoided
Anyway I did something similar to you mark, but instead of redirect the person, I request our custom 404 page using the toolkit and just print the results. My whole NTFD page is 3 lines:
Code:<mvt:item name="toolkit" param="mvassign|status|miva_output_header( 'Status', '404 Not Found' ))" /> <mvt:item name="toolkit" param="callurl|404Output|http://www.mysite.com/?404=1|GET|" /> &mvt:global:404Output;
Looking for work as of March 2024! I've been a web developer for going on 20 years, with most of that time spent on Miva sites.
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
A little off the main topic of 404s, but I think this may apply as an extension to the previous posts:
If you make something like a PHP script to match up missing product/category codes to new URLs (through a switch/case or a database lookup, etc.), you could also handle 301 redirects from the NTFD page too.
It may be an alternative to having to do hundreds of htaccess lines when you can't just programmatically rewrite URLs. Like say if you have numerical category/product codes moving to more descriptive text versions ('1' --> 'books', '2' --> 'software').
I'm not taking into account overhead issues (if any?) of having to call a script whenever the NTFD page gets accessed. Hopefully somebody who's more "in the know" can fill in that blank. :)
Code:<mvt:if expr="g.Category_Code"> <mvt:item name="toolkit" param="callurl|4oh4|http://www.example.com/4oh4.php|GET|Category_Code" /> <mvt:elseif expr="g.Product_Code"> <mvt:item name="toolkit" param="callurl|4oh4|http://www.example.com/4oh4.php|GET|Product_Code" /> </mvt:if> <mvt:if expr="NOT ISNULL g.4oh4"> <mvt:item name="toolkit" param="mvassign|g.ok|miva_output_header( 'Status', '301 Moved Permanently' )" /> <mvt:item name="toolkit" param="mvassign|g.ok|miva_output_header( 'Location', g.4oh4 )" /> <mvt:else> <mvt:item name="toolkit" param="mvassign|status|miva_output_header( 'Status', '404 Not Found' ))" /> <mvt:item name="toolkit" param="callurl|404Output|http://www.example.com/?404=1|GET|" /> &mvt:global:404Output; </mvt:if>
Code:<?php switch($_GET['Category_Code']) { case 'old-category-code': echo 'http://www.example.com/ctgy/new-category-code.html'; exit(); default: exit(); } ?>
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
darian that's an EXCELLENT idea - I've been doing the htaccess thing for a while, I'd much rather do a php script / miva combo to handle this type of thing. Guess I have a new project to work on this week, thanks!Looking for work as of March 2024! I've been a web developer for going on 20 years, with most of that time spent on Miva sites.
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
Originally posted by Rick Wilson View PostWe'll fix this in Core 18 for now see the thread Bill mentioned.
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
Core 18 was going to be Wombat but the way we ran the Beta, Wombat has to be PR7.
Regardless, we were planning on adding that into Wombat and I think it hasn't made the cut. I know you can do it currently with ToolKit and possibly ToolBelt.
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
If you have Toolbelt use this at the top of the NTFD page.Code:<mvt:item name="ry_toolbelt" param="assign|g.trash|miva_output_header( 'Status', '404 Not Found' )" />
Just Brilliant. I was working on 1000 category 301 redirects today (the category codes made seo friendly), so I'm thinking I will doing it all un Storemorph / Toolbelt instead of the .htaccess file.
I'm going to redirect the 404 error to an intermediate page. On that page I will determine if the s.REQUEST_URI is a category page and contains a category code.
Then use Query to get a custom category field to get the new category code, issue a 301 and redirect to the correct page (in short links format). Otherwise, I'll use the Screen command to load and display NTFD page where a 404 will be issued.Ray Yates
"If I have seen further, it is by standing on the shoulders of giants."
--- Sir Isaac Newton
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
Originally posted by Rick Wilson View PostWe'll fix this in Core 18 for now see the thread Bill mentioned.
I know I requested this initally but now I would prefer that it be optional, that the NTFD page returned the 404 status.
The reason is that I've worked out how to do 301 re-directs for renamed category codes, directly inside the NTFD page template and avoid adding them to the .htaccess file.
The perfect solution would be for the 404 status message to be output by a component included in the NTFD page template, providing a way to control if and when it's used.Ray Yates
"If I have seen further, it is by standing on the shoulders of giants."
--- Sir Isaac Newton
Comment
-
Re: Page NTFD - return a 404 status code instead of 200?
Originally posted by Rick Wilson View PostIt's going to be optional. We couldn't come up with a good reason, but we decided to create a component you could add to ANY page and edit the output to anything you want.
So we'll default it to 404, but it's really up to you.Ray Yates
"If I have seen further, it is by standing on the shoulders of giants."
--- Sir Isaac Newton
Comment
Comment