violinman Posted June 14, 2017 Share Posted June 14, 2017 I have removed the cubecart error handler lines from the .htaccess file as I want to use my own guardian error handler which I have added to the top of the file. The trouble is the default cubecart "404 - Page Not Found" still appears! I have cleared all caches. Do I also need to change some code somewhere in admin to suppress it? Many thanks, Brian Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 14, 2017 Share Posted June 14, 2017 If the URL matches CubeCart's friendly seo-path format (basically anything ending in .html), the URL rewrite code in the .htaccess file will do its thing and send the resulting rewritten URL to CubeCart. CubeCart, then, will not find what you are experimenting with and will execute its internal 404 response code. There may be little to no way Guardian can determine if the seo friendly URL actually points to a product, document, or category. I do not how a PHP script can inform the web server to execute a separate auxiliary program to custom handle a 404 situation. Quote Link to comment Share on other sites More sharing options...
violinman Posted June 14, 2017 Author Share Posted June 14, 2017 I don't quite follow that as I have removed the CubeCart error handling lines from the bottom of the .htaccess file and added the guardian error handler instead, guardian works some of the time. All of the 301 redirects perform correctly and show the correct CubeCart pages that correspond to the old URLs but if I call a nonexistent page the CubeCart 404 error page still shows, even though I now have guardian as my error handler? Very strange behaviour, I will have to keep looking. Brian Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 14, 2017 Share Posted June 14, 2017 Please give us a URL that you know should cause Guardian to handle the 404 but isn't. Quote Link to comment Share on other sites More sharing options...
violinman Posted June 15, 2017 Author Share Posted June 15, 2017 Hello, that is quite difficult as the site is not live as yet so the only way to reach it from the net is to add an entry to your hosts file so that you go to the correct site rather than the live site. Brian Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 15, 2017 Share Posted June 15, 2017 Viewing the page is not my intent. If you give me a URL that looks like: www.example.com/this-product-does-not-exist.html I will say that the rewrite directives in the .htaccess file will send to CubeCart this URL: www.example.com/index.php?seo-path=this-product-does-not-exist CubeCart will not find 'this-product-does-not-exist' in the database and will therefore send out its 404 page. So, I am asking for that part of the URL, that does not include the domain name, that does not work as expected. We will use this to see how the .htaccess directives are suppose to handle it. Quote Link to comment Share on other sites More sharing options...
violinman Posted June 15, 2017 Author Share Posted June 15, 2017 Hello, I think I have found the problem but not sure how to deal with it! As I explained I had removed all the lines in .htaccess that relate to the CubeCart error handler, in fact I removed all of the CubeCart specific stuff but when I open the store page it just writes it all back into the .htaccess file! How can I deal with that? Can I make the .htaccess file read only? Brian Quote Link to comment Share on other sites More sharing options...
violinman Posted June 15, 2017 Author Share Posted June 15, 2017 That didn't work, I made the .htaccess file read only (CHMOD 444) having removed all reference to CubeCart error handler but still it uses it, I have tried with all sorts of different file names, testfile.html, error-file.html, it makes no difference which file. The only time guardian works is when I have removed the CubeCart SEO rewrite stuff from the .htaccess file, but then every page throws an error! in guardian!! Brian Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 15, 2017 Share Posted June 15, 2017 Having removed the rewrite directives that CubeCart needs from the .htaccess file, when CubeCart checks for the presence of these directives and finds them missing, CubeCart will add them back. CubeCart (version 6) needs these rewrite directives to function correctly. www.example.com/testfile.html This URL matches the pattern specified in the rewrite directive. So, the directive will rewrite the URL to: www.example.com/index.php?seo_path=testfile Your store probably will not have a document, product, or category named "Testfile". So, CubeCart sends its internal 404 page. With dynamically generated pages, it up to the application that generates the pages to handle the scenario of what to do when there is no relevant data to create a dynamic page. Quote Link to comment Share on other sites More sharing options...
violinman Posted June 17, 2017 Author Share Posted June 17, 2017 Hi Barry or Brian, Thanks for that, I have spent too much time on this issue and it is probably not that important! I am going to just accept the 404 handling of the error. As far as I can see the guardian error handler will kick in for other errors such as 500 so that is ok. Please mark this post as resolved as it is a bit like looking down a rabbit hole! Thank you, Brian Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.