Results 1 to 10 of 10

Threaded View

  1. #7
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Help with Rewrite Rules

    Quote Originally Posted by jgold723 View Post
    ...
    RewriteEngine On
    RewriteRule ^index.php?main_page=product_info&products_id=1$ index.php?main_page=product_info&cPath=1&products_id=1 [R=301,L]

    It does absolutely nothing -- no errors, but no redirects.
    ...
    You cannot match "query terms" (everything after the ? in the URL) by using just RewriteRule. You need to use RewriteCond statements along with a RewriteRule. This is a common mistake made by novice users of Apache mod_rewrite. If you really really really must use a redirect... I'd recommend reading the mod_rewrite documentation from Apache or doing some searches for how to match "query terms" with mod_rewrite.

    Quote Originally Posted by jgold723 View Post
    ... But here's the problem -- the original developer uses conditional formatting on the product info page based on the cPath that's passed in the link. No cPath and the user gets a generic page that is not formatted correctly. ...
    It sounds like you want some extra template code to always be inserted into the page when a product is in a certain "category"... if this is correct, adding an additional (and unnecessary) redirect does not seem like the best solution...

    If you want to match based upon master category:
    You can get the product's master category id by using the built in Zen Cart function zen_get_products_category_id($product_id)...
    If you need the entire cPath, you can use the built in Zen Cart function zen_get_product_path($products_id)...

    If you want to match based upon the parent category:
    You can use a SQL query to obtain the parent category id for the product...
    If you need the entire cPath use the built in Zen Cart function zen_get_generated_category_path_rev($categories_id)...
    Last edited by lhungil; 10 Aug 2013 at 08:07 PM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

 

 

Similar Threads

  1. Replies: 0
    Last Post: 24 Sep 2013, 04:32 PM
  2. help url rewrite in the IIS7.0?
    By jjyypi in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 7 Jul 2010, 11:15 AM
  3. .htaccess rewrite with folders and Private SSL?
    By littlehawk in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 14 Sep 2009, 07:10 PM
  4. Add Rewrite Rules to Apache?
    By mcleanmell2 in forum General Questions
    Replies: 5
    Last Post: 18 Mar 2009, 12:57 AM
  5. Homepage works, other pages give 404 - problem with SEO mod and rewrite rules
    By Nimbuz in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 20 Jan 2008, 02:07 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