|

404 with htaccess
Posted 15 November 2009 - 03:10 AM #1
knows somebody how can I disable parsing of the original 404 page of CS Cart?
I can't find any solution, I want to redirect the 404 error page to the home page through htaccess but it doesn't work, it shows still the CS Cart 404 parsed through exception.tpl file.
Thanks.
CS-Cart Professional €160.00 | CS-Cart Multi-Vendor €625.00 | CS-Cart Hosting | SSL Certificates
.
CS-Cart Optimized Servers *** USA & UK VPS Servers
Posted 03 December 2009 - 02:47 PM #2
replace it's content with:
{php}
header("Location: /");
{/php}
That's the easiest way to implement what you want. Not the "correct" way by any means, but it will work.
LAMP
Posted 03 December 2009 - 03:10 PM #3
edit the exception.tpl file under /skins/skin_name/customer/exception.tpl
replace it's content with:
{php}
header("Location: /");
{/php}
That's the easiest way to implement what you want. Not the "correct" way by any means, but it will work.
Hi, thanks for the tip.
That works as well:
<meta http-equiv="Refresh" content="0; url=http://www.yourdomain.com/">
CS-Cart Professional €160.00 | CS-Cart Multi-Vendor €625.00 | CS-Cart Hosting | SSL Certificates
.
CS-Cart Optimized Servers *** USA & UK VPS Servers
Posted 05 December 2009 - 11:53 AM #4
The code goes in the same place as the html one:
<script type="text/javascript">
<!--
window.location = "http://www.yourdomain.com"
//-->
</script>
4.11.5
Posted 05 December 2009 - 12:51 PM #5
I use Javascript to redirect customers without they ever noticing it. with the HTML tag they will always see for a moment the error page and with Javascript they don't see it at all. Besides, it is said that google doesn't like this particular html tag.
Although the meta refresh often gets abused to trick visitors into popup hells by sneaky pages on low-life free hosts (poor man’s cloaking), search engines don’t treat every instance of the meta refresh as Webspam. Folks moving their free hosted stuff to their own domains rely on it to redirect to the new location:
META Refresh: <meta http-equiv=”refresh” content=…> is recognized as a 301 if it specifies little or no delay or as a 302 if it specifies noticeable delay.<meta http-equiv=refresh content="0; url=http://example.com/newurl" />
Best idea is to use 301/302s directly whenever possible; otherwise, next best is to do a metarefresh with 0 for a 301. I don’t believe we recommend or support any 302-alternative.
The number of users surfing with meta-refresh=off is only a tiny fraction of your visitors, and using JavaScript redirects is way more risky (WRT picky search engines) than a zero meta refresh. Also, JavaScript redirects "-if" captured by a search engine– should count as 302 and you really don’t want to deal with all the disadvantages of soft redirects.
CS-Cart Professional €160.00 | CS-Cart Multi-Vendor €625.00 | CS-Cart Hosting | SSL Certificates
.
CS-Cart Optimized Servers *** USA & UK VPS Servers
Posted 05 December 2009 - 01:04 PM #6
I don't see how could it make a difference in putting javascript or html to redirect in terms of 301 or 302, it will always be the exception page, this meaning, 404 page not found. Of course, I'm speaking in terms of putting these codes into the exception page.
There is an online tool where you can check how search engines view your exception page by inputing an old url that you know that is going to fall on the exception page:
http://www.seoconsul...ols/headers.asp
The php solution will give search engines an 302 redirect, wich, depending on what you want maybe good or bad. I think it is better to give the 404 not found so that google and others can refresh you site indexing removing old pages and replacing them with new ones.
4.11.5
Posted 05 December 2009 - 01:22 PM #7
CS-Cart Professional €160.00 | CS-Cart Multi-Vendor €625.00 | CS-Cart Hosting | SSL Certificates
.
CS-Cart Optimized Servers *** USA & UK VPS Servers
Posted 05 December 2009 - 01:27 PM #8
4.11.5
Posted 05 December 2009 - 01:38 PM #9
Well, I have a similar problem, can't make the 301 moved perm. in htaccess for my old shop pages, it does not respond well to this command, don't know why, so, 404 it must be untill google removes all of them.
If you will keep the ranking of your old pages, the you can use this htaccess rule:
For categories redirect:
For pages:RewriteEngine on
RewriteCond %{query_string} your_old_category_string
RewriteRule (.*) h**p://www.yourdomain.com/something/new_category/? [R=301,L]
RewriteCond %{query_string} your_old_page_string
RewriteRule (.*) h**p://www.yourdomain.com/something/new_category/new_page.html? [R=301,L]
CS-Cart Professional €160.00 | CS-Cart Multi-Vendor €625.00 | CS-Cart Hosting | SSL Certificates
.
CS-Cart Optimized Servers *** USA & UK VPS Servers
Posted 05 December 2009 - 07:47 PM #10
@vqcdesigns
Just verifying that the method you posted still allows CS to be the "Handler" of the header response codes? I presume changing to "/" will just redirect them to the homepage without notification?
Posted 15 February 2010 - 07:23 PM #11
In order to redirect a customer to the custom page of 404 error you should replace the following part of code:
if ($status == CONTROLLER_STATUS_NO_PAGE) { header(' ', true, 404); }
with this one:
if ($status == CONTROLLER_STATUS_NO_PAGE) { fn_redirect(Registry::get('config.http_location') . "/404.html"); }
in the "fn.control.php" file located in the "core" directory of your CS-Cart installation and put the "404.html" page to the root directory of your CS-Cart installation.
Posted 17 February 2010 - 09:20 PM #12
Here is the answer from cs-cart support I get.
In order to redirect a customer to the custom page of 404 error you should replace the following part of code:
if ($status == CONTROLLER_STATUS_NO_PAGE) { header(' ', true, 404); }
with this one:
if ($status == CONTROLLER_STATUS_NO_PAGE) { fn_redirect(Registry::get('config.http_location') . "/404.html"); }
in the "fn.control.php" file located in the "core" directory of your CS-Cart installation and put the "404.html" page to the root directory of your CS-Cart installation.
I just changed the "/404.html" to "/index.php" and they are just sent to the home page.
Works great thanks,
Posted 23 April 2010 - 01:08 PM #14
I am still on 1.3.5 (Too many custom mods) and could not locate fn.control.php in the root directory. Is this file under a different name in 1.3 or is there an equivalent?
Posted 14 May 2010 - 10:54 AM #15
The fn.control.php edit worked great for me too, just altered it to index.php as above
Posted 09 November 2010 - 08:52 PM #16

Here is the answer from cs-cart support I get.
In order to redirect a customer to the custom page of 404 error you should replace the following part of code:
if ($status == CONTROLLER_STATUS_NO_PAGE) { header(' ', true, 404); }
with this one:
if ($status == CONTROLLER_STATUS_NO_PAGE) { fn_redirect(Registry::get('config.http_location') . "/404.html"); }
in the "fn.control.php" file located in the "core" directory of your CS-Cart installation and put the "404.html" page to the root directory of your CS-Cart installation.
Lee Li Pop
If All Else Fails, Read The Instruction Manual! Knowledge Base 2.x + CS-Cart Instruction Manual
Hosted at Pair.com since 2000. Zero hacking attempts during first 11 years... And counting!
Posted 15 May 2011 - 04:37 AM #17
and put the "404.html" page to the root directory of your CS-Cart installation.
Or, you can create a new page:
Content > Pages
Name of this new page:
404 (or Oooops!)
Description:
We're sorry. The page is not active on this site.
Go to Home Page (with real link)
Status:
Hidden
Save.
Lee Li Pop
If All Else Fails, Read The Instruction Manual! Knowledge Base 2.x + CS-Cart Instruction Manual
Hosted at Pair.com since 2000. Zero hacking attempts during first 11 years... And counting!
Posted 25 August 2011 - 02:16 AM #19
I have been trying for days to figure out how to modify the .htaccess file to redirect broken links to the index.php page and just came across this solution. YEEEHAAA, it fixed our problem as well!I just changed the "/404.html" to "/index.php" and they are just sent to the home page.
Works great thanks,
MUCH OBLIGED!!!

Posted 06 November 2011 - 10:23 PM #20
Or, you can create a new page:
Content > Pages
Name of this new page:
404 (or Oooops!)
Description:
We're sorry. The page is not active on this site.
Go to Home Page (with real link)
Status:
Hidden
Save.
Lee Li Pop
I was using this by your suggestion for last 6 months but in last few days I came to know by some redirect checkers this method cause 302 redirect which is not SEO friendly now Google webmaster tool is also reporting soft404s
www.360bin.com