Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

404 with htaccess Rate Topic   - - - - -

 
  • indy0077
  • Senior Member
  • Banned
  • Join Date: 03-Nov 09
  • 1431 posts

Posted 15 November 2009 - 03:10 AM #1

Hi,

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

 
  • viusllc
  • Junior Member
  • Members
  • Join Date: 17-Apr 08
  • 39 posts

Posted 03 December 2009 - 02:47 PM #2

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.
CS-Cart 2.0.8
LAMP

 
  • indy0077
  • Senior Member
  • Banned
  • Join Date: 03-Nov 09
  • 1431 posts

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

 
  • E.Qi.Librium
  • Senior Member
  • Members
  • Join Date: 05-Sep 09
  • 472 posts

Posted 05 December 2009 - 11:53 AM #4

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.

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


 
  • indy0077
  • Senior Member
  • Banned
  • Join Date: 03-Nov 09
  • 1431 posts

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 http-equiv=refresh content="0; url=http://example.com/newurl" />

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.

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

 
  • E.Qi.Librium
  • Senior Member
  • Members
  • Join Date: 05-Sep 09
  • 472 posts

Posted 05 December 2009 - 01:04 PM #6

I must disagree with part of it as search engines continue interpreting the exception page as an 404 not found and not as 301 or 302.
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


 
  • indy0077
  • Senior Member
  • Banned
  • Join Date: 03-Nov 09
  • 1431 posts

Posted 05 December 2009 - 01:22 PM #7

Yes, and that is the problem, because I can't make a server side redirect where the header send a 200 OK to the SE.
.
CS-Cart Professional €160.00 | CS-Cart Multi-Vendor €625.00 | CS-Cart Hosting | SSL Certificates
.
CS-Cart Optimized Servers *** USA & UK VPS Servers

 
  • E.Qi.Librium
  • Senior Member
  • Members
  • Join Date: 05-Sep 09
  • 472 posts

Posted 05 December 2009 - 01:27 PM #8

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.

4.11.5


 
  • indy0077
  • Senior Member
  • Banned
  • Join Date: 03-Nov 09
  • 1431 posts

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:

RewriteEngine on
RewriteCond %{query_string} your_old_category_string
RewriteRule (.*) h**p://www.yourdomain.com/something/new_category/? [R=301,L]

For pages:

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

Thread has officially been derailed. (Once Again)

@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?
I've moved on from CS-Cart to WooC******** - If you need anything I can be of little help.

 
  • kocalka
  • Junior Member
  • Members
  • Join Date: 01-Feb 10
  • 15 posts

Posted 15 February 2010 - 07:23 PM #11

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.

 
  • CutRiteFX
  • Senior Member
  • Members
  • Join Date: 02-Jun 08
  • 434 posts

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,


 
  • sh1nn3r
  • Member
  • Members
  • Join Date: 19-Nov 09
  • 85 posts

Posted 08 April 2010 - 03:06 PM #13

I did the same works great!

 
  • moonmerch
  • Junior Member
  • Members
  • Join Date: 09-Jan 07
  • 27 posts

Posted 23 April 2010 - 01:08 PM #14

Hi,

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?

 
  • TeeJay
  • Junior Member
  • Members
  • Join Date: 18-Dec 08
  • 18 posts

Posted 14 May 2010 - 10:54 AM #15

Thanks folks
The fn.control.php edit worked great for me too, just altered it to index.php as above

 
  • Lee Li Pop
  • Senior Member
  • Members
  • Join Date: 07-Mar 08
  • 941 posts

Posted 09 November 2010 - 08:52 PM #16

Thank you Kocalka Posted Image

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!

 
  • Lee Li Pop
  • Senior Member
  • Members
  • Join Date: 07-Mar 08
  • 941 posts

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!

 
  • miracles
  • Senior Member
  • Members
  • Join Date: 19-Sep 07
  • 1533 posts

Posted 17 May 2011 - 10:09 AM #18

Thanks it works nice.
CS-CART 3.0.6 GRENADE

Please vote for CDN Add-on

For SEO Article Submission, Forum Profile Links, Web 2.0 links, contact me through PM.

 
  • Bill G.
  • Member
  • Members
  • Join Date: 06-Feb 08
  • 54 posts

Posted 25 August 2011 - 02:16 AM #19

I just changed the "/404.html" to "/index.php" and they are just sent to the home page.
Works great thanks,

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!
MUCH OBLIGED!!!
:D

 
  • ather
  • Junior Member
  • Members
  • Join Date: 29-Apr 10
  • 16 posts

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
Ather Sheikh
www.360bin.com