Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: 301 redirect in htaccess not working

    Rewriting addresses that contain & and = parameters is often quite complex in .htaccess.

    Try explaining again what you want to accomplish. Pretend you know nothing about htaccess and ways to do redirects. What is the situation you have now and what do you want to end up with? Maybe there's an easier or better way to get there ...
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  2. #2
    Join Date
    Jan 2007
    Posts
    65
    Plugin Contributions
    0

    Default Re: 301 redirect in htaccess not working

    A client with a store containing hunfreds of categories asked us to create "mirror categories": they don't want to create item "aliases" during the listing process (item listed in several categories), so we are trying to make a "dummy category" whose sole purpose will be to redirect to the category that has the items in it.

    The category in question has dozens of subcategories and we think this is not the best way to go. A redirect seemed to be the easiest way to handle this...

    Thank you for your help.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: 301 redirect in htaccess not working

    And this is for just "one" category to be redirected, right?

    Is this a top-level category, or is it a subcat ?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Jan 2007
    Posts
    65
    Plugin Contributions
    0

    Default Re: 301 redirect in htaccess not working

    actually, we would have several, some are subcats

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: 301 redirect in htaccess not working

    Try this:
    1. copy the /includes/init_includes/init_category_path.php file to the/includes/init_includes/overrides folder.

    2. edit the new file in the overrides folder.
    Near the bottom of the file (around line 40) you'll see this:
    Code:
    $this_is_home_page = ($current_page=='index' && (!isset($_GET['cPath'])) && (!isset($_GET['manufacturers_id'])) && (!isset($_GET['typefilter'])) );
    ?>
    insert some extra code before the last line, like this:
    Code:
    $this_is_home_page = ($current_page=='index' && (!isset($_GET['cPath'])) && (!isset($_GET['manufacturers_id'])) && (!isset($_GET['typefilter'])) );
    
    // redirect certain categories to others, instead of the usual approach of cross-linking products to alternate categories via the admin
    $newPath = '';
    if ($cPath == '3_12') $newPath = '54_60';
    if ($cPath == '22') $newPath = '2_19';
    
    if ($newPath != '') {
      header("HTTP/1.1 301 Moved Permanently");
      zen_redirect(zen_href_link(FILENAME_DEFAULT, 'cPath=' . $newPath));
    }
    ?>
    Substitute the cPath and newPath values as needed. Duplicate as needed.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Jan 2007
    Posts
    65
    Plugin Contributions
    0

    Default Re: 301 redirect in htaccess not working

    hahahahhhhh I BUY THIS ONE!

    Thank you Doctor, I'm feeling much better now :-)

    Have a great day!

 

 

Similar Threads

  1. v151 redirect 301 is not working
    By cvandijk in forum Basic Configuration
    Replies: 3
    Last Post: 23 Oct 2013, 09:19 PM
  2. Can't login after adding a 301 redirect in .htaccess
    By eutopia in forum Basic Configuration
    Replies: 0
    Last Post: 11 Oct 2011, 02:27 AM
  3. 301 redirect not working
    By plymgary1 in forum General Questions
    Replies: 5
    Last Post: 10 Jul 2010, 02:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg