Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2010
    Location
    France
    Posts
    291
    Plugin Contributions
    0

    Idea or Suggestion htaccess remove many products with gone

    RewriteCond %{QUERY_STRING} main_page=product_info&products_id=[1,2,3,4,5,6,7,8,9,10,11] [NC]
    RewriteRule ^ - [L,G=410]

    What wrong has this code?
    PHP Code:
    RewriteCond %{QUERY_STRINGmain_page=product_info&products_id=[1,2,3,4,5,6,7,8,9,10,11] [NC]
    RewriteRule ^ - [L,G=410
    If I click on a product type by entering this code on http: //www .mydomain .com/index.php?main_page=product_info&products_id=571 .htaccess get a page with error 404 not found

    no category in the link I get error 404

    when I enter
    # http: //www .mydomain .com/index.php?main_page=product_info&cPath=170&products_id=571 the link works

    with the category in the link works


    if I remove the code:
    PHP Code:
    RewriteCond %{QUERY_STRINGmain_page=product_info&products_id=[1,2,3,4,5,6,7,8,9,10,11] [NC]
    RewriteRule ^ - [L,G=410
    everything works.

    I'm trying to put this code because i have many products removed.
    Last edited by diamond1; 28 Oct 2015 at 01:50 PM.
    Giovanni,
    Zen Cart V2.1

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: htaccess remove many products with gone

    Why are you doing this instead of having ZC respond/act differently based on the absence of the product?

    If you REALLY must have an .htaccess file action, then the following was "developed" for your situation:

    Code:
    RewriteCond %{QUERY_STRING} main_page=product_info& [NC] 
    RewriteCond %{QUERY_STRING} products_id=(1$|1&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(2$|2&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(3$|3&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(4$|4&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(5$|5&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(6$|6&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(7$|7&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(8$|8&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(9$|9&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(10$|10&) [OR,NC] 
    RewriteCond %{QUERY_STRING} products_id=(11$|11&) [NC]
    RewriteRule ^ -? [L,G=410]
    Note though, this addresses whether the query string ends with products_id=(applicable #) or if it is somewhere in between and does not exhibit the issue of matching the beginning of the character to the right of the equals sign to the value of 5 like it was doing before...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jan 2010
    Location
    France
    Posts
    291
    Plugin Contributions
    0

    Default Re: htaccess remove many products with gone

    ok thanks I try.
    Giovanni,
    Zen Cart V2.1

  4. #4
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: htaccess remove many products with gone

    After posting the above, I realized it could be simplified/shortened even further...

    Code:
    RewriteCond %{QUERY_STRING} main_page=product_info& [NC] 
    RewriteCond %{QUERY_STRING} products_id=(1$|1&|2$|2&|3$|3&|4$|4& etc...) [NC] 
    RewriteRule ^ -? [L,G=410]
    Sorry, didn't duplicate all of the content, the etc... represents to continue the remaining with the same process...
    Last edited by mc12345678; 29 Oct 2015 at 10:41 PM. Reason: remove the OR
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jan 2010
    Location
    France
    Posts
    291
    Plugin Contributions
    0

    Default Re: htaccess remove many products with gone

    Perfect thanks,
    Giovanni,
    Zen Cart V2.1

 

 

Similar Threads

  1. v139h Performance Issues on site with many products
    By totalsam in forum Setting Up Categories, Products, Attributes
    Replies: 19
    Last Post: 8 Mar 2012, 09:27 AM
  2. Replies: 0
    Last Post: 26 Jan 2012, 02:39 PM
  3. .htaccess problems with media previews in music products
    By BlessIsaacola in forum Upgrading from 1.3.x to 1.3.9
    Replies: 5
    Last Post: 22 Apr 2010, 01:51 AM
  4. items/products - how many is too many?
    By fishingmaniac in forum General Questions
    Replies: 1
    Last Post: 7 Jan 2010, 01:59 AM
  5. Help with adding attributes to many products
    By mdegrandis in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 9 Jun 2009, 10:10 PM

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